previous  next

Generated XSLT Functions

Not all of XQuery can be expressed as a single XPath expression in an XSLT select attribute.

count((<a/>,1+2,<b/>))
    <xsl:template name="main">
      <xsl:for-each select="$input">
	<xsl:sequence select="count((xq:xpath_d1e27(.)))"/>
      </xsl:for-each>
    </xsl:template>

    <xsl:function name="xq:xpath_d1e27" as="item()*">
      <xsl:param name="xq:here"/>
      <xsl:for-each select="$xq:here">
	<xsl:element name="a"/>
	<xsl:sequence select="( 1  +  2 )"/>
	<xsl:element name="b"/>
      </xsl:for-each>
    </xsl:function>