[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Ordered union of sequences
Still found the time to correct a typo and to remove the redundant
distinct-values():
<xsl:function name="my:sortkey" as="xs:integer"> <xsl:param name="input" as="element(*)" /> <xsl:param name="seen" as="xs:string*" /> <xsl:if test="name($input) = $seen"> <xsl:message terminate="yes">Element <xsl:value-of select="name($input)"/> doesn't seem to occur at a deterministic position. </xsl:message> </xsl:if> <xsl:variable name="preceding-siblings" select="$input/../../seq/*[ name() = name($input) ]/preceding-sibling::*[1]" as="element(*)*" /> <xsl:variable name="seen" select="($seen, name($input))" /> <xsl:sequence select="( max( for $ps in $preceding-siblings return my:sortkey($ps, $seen) ) + 1, 1 )[1]"/> <!-- short form of if(not(empty($preceding-siblings))) --> </xsl:function> On 08.04.2010 18:07, Imsieke, Gerrit, le-tex wrote: <xsl:function name="my:sortkey" as="xs:integer"> <xsl:param name="input" as="element(*)" /> <xsl:param name="previously-seen" as="xs:string*" /> <xsl:if test="name($input) = $previously-seen"> <xsl:message terminate="yes">Element <xsl:value-of select="name($input)"/> doesn't seem to occur at an deterministic position. </xsl:message> </xsl:if> <xsl:variable name="preceding-siblings" select="$input/../../seq/*[name() = name($input)]/preceding-sibling::*[1]" as="element(*)*" /> <xsl:variable name="seen" select="distinct-values(($previously-seen, name($input)))" /> <xsl:sequence select="(max(for $ps in $preceding-siblings return my:sortkey($ps, $seen)) + 1, 1)[1]"/> </xsl:function>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|