[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: xsl sorting
Heppa, > If there is several sorting orders, they are all applied and not > only the last one. For example if there is xml file that includes > severals sets like: > > <Subject id="0000000001" id2="001" id3="001">Juu juu</Subject> > <Subject id="0000000001" id2="002" id3="002">RE:Juu juu</Subject> > <Subject id="0000000001" id2="002" id3="001">RE:Juu juu</Subject> > > and sets are sorted: > <xsl:sort select="Subject/@id" order="ascending" /> > <xsl:sort select="Subject/@id2" order="ascending" /> > <xsl:sort select="Subject/@id3" order="ascending" /> > > So the result would be: > <Subject id="0000000001" id2="001" id3="001">Juu juu</Subject> > <Subject id="0000000001" id2="002" id3="001">RE:Juu juu</Subject> > <Subject id="0000000001" id2="002" id3="002">RE:Juu juu</Subject> > > Right? Right, but make sure when you're using the sort instruction that your context node is the corrent one for the sort select expressions. If you have <xsl:for-each select="Subject"> <xsl:sort select="Subject/@id" order="ascending" /> <xsl:sort select="Subject/@id2" order="ascending" /> <xsl:sort select="Subject/@id3" order="ascending" /> <xsl:copy-of select="." /> </xsl:for-each> that will not work, because the Subject doesn't have a Subject child. Instead use <xsl:template match="f"> <xsl:for-each select="Subject"> <xsl:sort select="@id" order="ascending" /> <xsl:sort select="@id2" order="ascending" /> <xsl:sort select="@id3" order="ascending" /> <xsl:copy-of select="." /> </xsl:for-each> </xsl:template> Cheers, Santtu XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|