Subject: Re: [xsl] Problems sorting data From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 4 Jul 2005 16:31:31 +0100 |
But I'm not quite sure what you meant by the xsl:strip-space and inter-element space though. I's appreciate if you could explain that a bit more. your document looked like <contents> <object type="standard"> .... </object> <object type="standard"> ... so the first 4 child nodes of contents are 1) a text node with two newline characters (#10) 2) an object element 3) a text node with two newline characters (#10) 4) an object element so if you do <xsl:apply-templates/> that is <xsl:apply-templates/ select="node()"/> and selects all four of those nodes. You then sort using <xsl:sort select="member[@name='idstring']"/> the text nodes don't have a member child so they get the sort key of "" so will all sort together (first in order, most likely) Unles you have another template matching text() the default template will be used which will copy these nodes to the output. Look at your generated file: you should see a lot of blank lines. You can avoid this problem be either just selecting the elementnodes, as i suggested, or adding <xsl:strip-space elemenets="contents"/> in which case the white space text nodes will be removed before the process starts, so in that case contents will only have object element children. The other isssue is, you have <xsl:sort select="member[@name='idstring']"/> so the sort key for is the string value of memebr element which is all the character content of its descendents which is " Unique1 " that is, the string begins with a newline and three tab characters. If your processor doesn't ignore thses (and nothing in the spec implies that it should ignore them) then any element that is indented less will sort earlier. If instead you had gone <xsl:sort select="member[@name='idstring']/string"/> then the sort key would be the string value of the string element which is "Unique1" so the issue about indentation would not arrise. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Problems sorting data, Glenn Thomas Hvidste | Thread | Re: [xsl] Problems sorting data, David Carlisle |
[xsl] Using format-number() to disp, Maria Amuchastegui | Date | Re: [xsl] Using format-number() to , Joris Gillis |
Month |