[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] XSLT Sort - returning attributes
Subject: [xsl] XSLT Sort - returning attributes From: karloswart@xxxxxxxxxxxxxx Date: Fri, 16 May 2003 11:35:20 +0100 |
PLAT: WIN2K MSXML2.Domdocument40 using 'transformNodeToObject' Hi, very simply Im trying to do a plain sort on my XML Doc. I want to return the XML doc in exactly the same format that it was input into, simply sorted. Using Microsoft's MSDN example: XML FILE <?xml version="1.0"?> <COLLECTION dateCreated="01-04-2000"> <BOOK PK="2" > <TITLE>Splish Splash</TITLE> <AUTHOR>Paula Thurman</AUTHOR> <PUBLISHER>Scootney</PUBLISHER> </BOOK> <BOOK PK="1" > <TITLE>Splish Splash</TITLE> <AUTHOR>Paula Thurman</AUTHOR> <PUBLISHER>Scootney</PUBLISHER> </BOOK> </COLLECTION> XSL STYLESHEET <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <PriceList> <xsl:for-each select="COLLECTION/BOOK"> <xsl:sort select="@PK" data-type="number"/> <xsl:copy> <xsl:apply-templates select="*"/> <xsl:apply-templates select="@*"/> [my inserted line] </xsl:copy> </xsl:for-each> </PriceList> </xsl:template> <xsl:template match="*"> <xsl:copy> <xsl:apply-templates /> </xsl:copy> </xsl:template> </xsl:stylesheet> END Basically from the above example, " <xsl:apply-templates select="*"/> " will return me all the elements of the book node, however I also want to retrieve all attributes. I 've tried " <xsl:apply-templates select="@*"/> " to get all attributes, but obviously Im doing something wrong. Is there any simpler way of going about sorting an xml doc and returning the entire document in XML format (only sorted) ? thanks Karlo Swart XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] An interesting angle on t, Mike Haarman | Thread | RE: [xsl] XSLT Sort - returning att, David Neary |
RE: [xsl] Using or ignoring Types i, Mark Seaborne | Date | RE: [xsl] XSLT Sort - returning att, David Neary |
Month |