Subject: Re: [xsl] sorting related issue From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 14 Dec 2001 17:16:57 +0000 |
Hi Sanjay, > I tried the following > > <xsl:variable name="sortedErrorMessage"> > <xsl:for-each select="/ErrorMessages/ErrorMessage"> > <xsl:sort select="Name" order="ascending" /> > <xsl:sort select="Type" order="ascending" /> > <xsl:value-of select="Name" /> > <xsl:value-of select="Type" /> > <xsl:value-of select="Details" /> > </xsl:for-each> > </xsl:variable> This creates a variable called $sortedErrorMessage which contains the *values of* the Name, Type and Details elements, in order. Note that it doesn't contain any elements. > and then if I add > <xsl:for-each select="msxsl:node-set($sortedErrorMessage)/Name"> > <xsl:value-of select="."/> > </xsl:for-each> The msxsl:node-set() function converts the result tree fragment to a node set and returns the root node of that node set. You're then looking for Name child elements of the root node - there aren't any because you didn't create any. I think that you should change the way that you create the variable. Try using: <xsl:variable name="sortedErrorMessage"> <xsl:for-each select="/ErrorMessages/ErrorMessage"> <xsl:sort select="Name" order="ascending" /> <xsl:sort select="Type" order="ascending" /> <xsl:copy-of select="." /> </xsl:for-each> </xsl:variable> That creates copies of the ErrorMessage elements, and the $sortedErrorMessage variable's root node has several ErrorMessage children, in order. Then you can do: <xsl:for-each select="msxsl:node-set($sortedErrorMessage)/ErrorMessage"> <xsl:value-of select="Name"/> </xsl:for-each> For example. I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] sorting related issue, Sanjay Pandey/Towers | Thread | RE: [xsl] sorting related issue, Michael Kay |
Re: [xsl] for-each order, Jeni Tennison | Date | Re: [xsl] for-each order, Trevor Nash |
Month |