I was trying to create a simple extension function and invoke it from an xslt stylesheet.
Saxon gives me the following error for the simple xslt and xml source files listed below.
What am I doing wrong?
command line and error output:
-------------------------------------
$ java net.sf.saxon.Transform -t -novw source.xml test.xslt
Saxon 8.8J from Saxonica
Java version 1.5.0_09
Stylesheet compilation time: 781 milliseconds
Processing file:/c:/src/belxml/dev/source.xml
Building tree for file:/c:/src/belxml/dev/source.xml using class net.sf.saxon.tinytree.TinyBuilder
Tree built in 0 milliseconds
Tree size: 46 nodes, 97 characters, 4 attributes
Error on line 15 of file:/c:/src/belxml/dev/test.xslt:
Cannot find a matching 1-argument function named {testing}exampleCall()
Transformation failed: Run-time errors were reported
test.xslt:
----------
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="
XSLT namespace"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:fubar="testing"
extension-element-prefixes="fubar"
>
<msxsl:script implements-prefix="fubar" language="C#">
<![CDATA[
public string exampleCall( string str ){return str;}
]]>
</msxsl:script>
<xsl:template match="person">
<p><xsl:value-of select="fubar:exampleCall(@name)" /></p>
</xsl:template>
</xsl:stylesheet>
source.xml:
--------------
<?xml version="1.0"?>
<people>
<person born="1912" died="1954">
<name>
<first_name>Alan</first_name>
<last_name>Turing</last_name>
</name>
<profession>computer scientist</profession>
<profession>mathematician</profession>
<profession>cryptographer</profession>
</person>
<person born="1918" died="1988">
<name>
<first_name>Richard</first_name>
<middle_initial>P</middle_initial>
<last_name>Feynman</last_name>
</name>
<profession>physicist</profession>
<hobby>Playing the bongoes</hobby>
</person>
</people>