|
I get an error when using your example:
Error: Namespace 'http://whatever' does not contain any functions.
Code:
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:functx="http://whatever" >
<xsl:function name="functx:index-of-match-first" as="xs:integer?" >
<xsl:param name="arg" as="xs:string?"/>
<xsl:param name="pattern" as="xs:string"/>
<xsl:sequence select="
if (matches($arg,$pattern))
then string-length(tokenize($arg, $pattern)[1]) + 1
else ()
"/>
</xsl:function>
<xsl:template match="rss/channel">
<xsl:element name="item">
<xsl:for-each select="item">
<xsl:attribute name="FName">
<xsl:value-of select="title"/>
</xsl:attribute>
<xsl:attribute name="LName">
<xsl:variable name="Desc">
<xsl:value-of select="description"/>
</xsl:variable>
<xsl:value-of select="functx:index-of-match-first($Desc,'Last Name:')" />
</xsl:attribute>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Does anyone know why? Thanks
|