[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: sorting related issue
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
|
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
|