Subject: Re: [xsl] Ordered union of sequences From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx> Date: Thu, 08 Apr 2010 18:22:20 +0200 |
<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>
<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>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Ordered union of sequence, Imsieke, Gerrit, le- | Thread | Re: [xsl] Ordered union of sequence, Imsieke, Gerrit, le- |
RE: [xsl] problem with processing C, Wendell Piez | Date | [xsl] Grouping problem, Joel Dubien |
Month |