xsl-list
[Top] [All Lists]

Re: [xsl] Template for node-set parents

2012-10-19 12:27:35
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?
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>