[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSLT Sort - returning attributes
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
|
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
|