Jens -- See http://www.w3.org/TR/xslt#for-each. It indicates that xsl:for-each processes the nodes in document order, as you are seeing.
To process them in the order you're expecting, I think you'll need to select the nodes yourself individually and do your own xsl:apply-templates. The tokenize() extension will probably help here. Inasmuch as this is a general XSLT question and not particular to XalanJ, you might want to pose it on the Mulberry List (http://www.mulberrytech.com/xsl/xsl-list/) where there are many more people and you'll get a faster, more detailed response. Gary -----Original Message----- From: Jens von Pilgrim [mailto:[EMAIL PROTECTED] Sent: Friday, November 23, 2001 8:41 AM To: Xalan-J-Users (E-Mail) Subject: IDREFS sorting Hello, when using IDREFS and the id function, the returned NodeSet is always sorted by the IDs and not (as expected) by the position in the IDREFS string. Example: XML-Fragment: ("ids" is defined as IDREFS, "id" is defined as ID) <item id="_01" /> <item id="_02" /> <item id="_03" /> <list ids="_01 _03 _02"/> Using: <xsl:template match="list"> <xsl:for-each select="id(@ids)"> <xsl:value-of select="@id" />, </xsl:for-each> </xsl:template> will output: _01, _02, _03 What I expect is: _01, _03, _02 Now I've got 2 questions: 1) Is this a bug or a feature? I didn't found something about that in the XSLT rec. 2) How can I sort the IDs in the order I expect? Cheers! jens ____________________________________________________________ Jens von Pilgrim 4flow AG Berlin, Germany
