[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] sort order elements
Subject: [xsl] sort order elements From: 04083259@xxxxxxxxxxxxx Date: Wed, 30 Mar 2005 17:30:50 +0100 (BST) |
sorry was some mising elements in the priviouse message : hi from the following xml database i am trying to output elements in revers order : <car> <AA><x>40</x><y>360</y><AA> <BB><x>40</x><y>360</y><x>120</x><y>280</y><BB> <C> <x>120</x><y>280</y></C> <D><x>40</x><y>360</y><x>120</x><y>280</y></D> <E><x>10</x><y>3</y></E> </car> i used the following template xslt1.0: <xsl:template match="car"> <xsl:copy> <xsl:for-each select="*"> <xsl:sort select="position()" data-type="number" order="descending" /> <xsl:copy> <xsl:for-each select="x"> <xsl:sort select="position()" data-type="number" order="descending" /> <xsl:copy-of select=". | following-sibling::y[1]" /> </xsl:for-each> </xsl:copy> </xsl:for-each> </xsl:copy> </xsl:template> </xsl:stylesheet> then the result was as following : <car> <E><x>10</x><y>3</y></E> <D><x>120</x><y>280</y> <x>40</x><y>360</y></D> <C><x>120</x><y>280</y> </C> <BB><x>120</x><y>280</y> <x>40</x><y>360</y><BB> <AA><x>40</x><y>360</y><AA> </car> that is exactly was i wanted except that i want the elements (A,B,C,D,E) to be in its original place such the following : <car> <AA><x>10</x><y>3</y><AA> <BB><x>120</x><y>280</y> <x>40</x><y>360</y><BB> <C><x>120</x><y>280</y> </C> <D><x>120</x><y>280</y> <x>40</x><y>360</y></D> <E><x>40</x><y>360</y> </E> </car> thanks
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] sort order elements, Michael Kay | Thread | Re: [xsl] sort order elements, David Carlisle |
[xsl] sort order elements, 04083259 | Date | Re: [xsl] Testing 2 XML documents f, Mukul Gandhi |
Month |
Keywords