xslt-2.0

How to include additional function in XSLT 2.0


I wanted to use the function 'substring-before-last' defined on http://www.functx.com. For this I added xmlns:functx="http://www.functx.com" in the <xsl:stylesheet> statement at top and then tried calling the function using functx:substring-before-last. I am getting an error 'Unknown Function'.

If you have tried using the additional functions defined outside XSL, please let me know how to do this.


Solution

  • Use <xsl:import href="http://www.datypic.com/xsl/functx-1.0.1-nodoc.xsl"/> in your stylesheet to import the library respectively download that file and then import your local copy.

    Example fiddle.