[Home] [By Thread] [By Date] [Recent Entries]
Try:
1. define a global variable $v1 that selects the result of the path expression in document order. 2. define another global variable $v2 that selects the sorted result of the path expression 3. Use a base template rule that's the identity copy 4. Add a template rule that matches nodes in $v1 (match="node()[. intersect $v1]). In this rule, determine the index position of this node in $v1 (count ($v1[. << $this]) + 1), and output the corresponding node from $v2 (copy-of select="$v2[$n]"). Michael Kay Saxonica On 19/10/2012 18:03, Darren Oh wrote: I am trying to generate a stylesheet that copies an XML source document. The only change should be that nodes selected by an XPath expression are sorted. I want this to work for any XML source document. The only information available to generate the stylesheet is the XPath expression and the sort criteria. I think this requires creating a template for the parents of the nodes selected by the XPath expression. How can I do this?
|

Cart



