I have an XSL stylesheet for which I need to add some custom string manipulations using the xsl: function. But I am having trouble trying to determine where to place this function in my document.
My simplified XSL looks like this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:my="myFunctions" xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="Master.xslt"/>
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:page-sequence master-reference="first">
<fo:flow flow-name="xsl-region-body">
<fo:block xsl:use-attribute-sets="heading">
HelloWorld
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
And I want to put a simple function, let's say
<xsl:function name="my:helloWorld">
<xsl:text>Hello World!</xsl:text>
</xsl:function>
But I canβt decide where to put this function, when I put it under the node, I get the error message: "xsl: function" cannot be a child of the "xsl: stylesheet". Element, and if I put it under the node, I get a similar error.
Where should I put the function? Idealy I would like to put my functions in an external file and import them into my xsl files.