Subject: Questions on sorting From: Ian Brockbank <ian@xxxxxxxxxxxxxx> Date: Thu, 26 Aug 1999 10:29:35 +0100 |
Hi all, I'm a bit confused by the interaction of xsl:sort and the various axes. I suppose basically my question is: does xsl:sort affect the ordering of nodes for the purpose of reference within the stylesheet, or just for the purpose of the output? To try to get a grip on this, I took this XML <?xml version="1.0"?> <root> <foo>D</foo> <foo>C</foo> <foo>A</foo> <foo>B</foo> </root> and this stylesheet <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" indent-result="yes"> <!-- The root of the document --> <xsl:template match="/"> <xsl:for-each select="//foo"> <xsl:sort/> <xsl:value-of select="."/>:<xsl:for-each select="preceding-sibling"> <xsl:value-of select="."/> </xsl:for-each>/<xsl:for-each select="following-sibling"> <xsl:value-of select="."/> </xsl:for-each> <xsl:text> </xsl:text> </xsl:for-each> </xsl:template> </xsl:stylesheet> And I obviously don't understand preceding-sibling, because the output (using the latest XT) was A:/ B:/ C:/ D:/ So two questions: 1) When processing C what are: preceding-sibling (A+B or D)? following-sibling (D or A+B)? and would this change if the xsl:sort came after the xsl:apply-templates? 2) Why doesn't <xsl:for-each select="preceding-sibling"> <xsl:value-of select="."/> </xsl:for-each> print anything out? Thanks, Ian -- Ian Brockbank, Indigo Active Vision Systems, The Edinburgh Technopole, Bush Loan, Edinburgh EH26 0PJ Tel: 0131-475-7234 Fax: 0131-475-7201 work: ian@xxxxxxxxxxxxxx personal: Ian.Brockbank@xxxxxxxxxxx web: ScottishDance@xxxxxxxxxxx http://www.scottishdance.net/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Help with lots of <'s, Tony Graham | Thread | RE: Questions on sorting, Kay Michael |
Re: PowerPoint is dead. Long live X, Steve Weyer | Date | XSL Wanted, Cristobal Galiano Fe |
Month |