title: Defining and using external functions ruby-xslt
body: <p>Has anyone got experience using ruby-xslt gem?</p>
  
  <p>I have it transforming XML perfectly but now I want to add an external function call which is proving very difficult. The documentation for this is a little light and the example provided makes no sense to me at all... see <a href="http://ruby-asp.rubyforge.org/ruby-xslt/files/README.html" rel="nofollow">http://ruby-asp.rubyforge.org/ruby-xslt/files/README.html</a></p>
  
  <p>I am defining my function as:</p>
  
  <pre><code>XML::XSLT.registerExtFunc("mynamespace","my-function") do |arg|
        #do something interesting
  end
  </code></pre>
  
  <p>In my stylesheet I do:</p>
  
  <pre><code>&lt;xsl:value-of select="mynamespace:my-function(/)"/&gt;
  </code></pre>
  
  <p>and I get the error:</p>
  
  <pre><code>xmlXPathCompOpEval: function my-function bound to undefined prefix mynamespace
  </code></pre>