[Home] [By Thread] [By Date] [Recent Entries]
On 10 19, 07, at 3:51 PM, Abel Braaksma wrote:
Michael Kay wrote:Start by defining what you want to achieve a little bit more precisely. Nodes with the string 'seite' must come first before those that do not have it. Those with seite are sorted according to the numeric value after it. I tried using this function to get the sorting key: <xsl:function name="ati:sort.key" as="node()"> <xsl:param name="node" as="element()"/> <xsl:variable name="node.value" as="xs:string" select="replace (normalize-space($node), '[\n], '')"/> <key> <key1><xsl:sequence select="replace($node.value, '^(S\. \d+).*|(.+) $', '$1')"/></key1> <key2><xsl:sequence select="replace($node.value, '^(S\. \d+).*|(.+) $', '$2')"/></key2> </key> </xsl:function> Then using the following sort instructions: <xsl:sort select="replace((ati:sort.key.nr(head))/key1, '[\D]', '')" data-type="number"/> <xsl:sort select="replace((ati:sort.key.nr(head))/key2, '[\D]', '')" data-type="number"/> -- Jeff
|

Cart



