Just for fun I've created exslt2.xslt and exslt2-test.xslt to model concepts discussed at EXSLT 2.0 forum. I did nothing special but used tuple as reference, and also I've defined f:call() to make function call indirectly.
<?xml version="1.0" encoding="utf-8"?> <!-- exslt 2 sketches. --> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:f="http://exslt.org/v2" xmlns:t="this" xmlns:p="private" exclude-result-prefixes="xs t f"> <xsl:include href="exslt2.xslt"/> <xsl:template match="/" name="main"> <root> <xsl:variable name="refs" as="item()*" select=" for $i in 1 to 20 return f:ref(1 to $i)"/> <total-items> <xsl:sequence select=" sum ( for $ref in $refs return count(f:deref($ref)) )"/> </total-items> <sums-per-ref> <xsl:for-each select="$refs"> <xsl:variable name="index" as="xs:integer" select="position()"/> <sum index="{$index}" value="{sum(f:deref(.))}"/> </xsl:for-each> </sums-per-ref> <add> <xsl:text>1 + 2 = </xsl:text> <xsl:sequence select="f:call(xs:QName('t:add'), (1, 2))"/> </add> </root> </xsl:template> <xsl:function name="t:add" as="xs:integer"> <xsl:param name="arguments" as="xs:integer+"/> <xsl:variable name="first" as="xs:integer" select="$arguments[1]"/> <xsl:variable name="second" as="xs:integer" select="$arguments[2]"/> <xsl:sequence select="$first + $second"/> </xsl:function> </xsl:stylesheet>
Code can be found at saxon.extensions.9.1.zip.
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u