[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: What is the simplest method for using xsl:sort wi
Mark Wilson wrote:
In the example below, only one <Item> is shown. I tried the template you suggested. I suggested to start with the identity transformation template and then to add a template or templates to perform the changes you want. So you would at least need <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:strip-space elements="*"/> <xsl:output method="xml" indent="yes"/> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="List"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates> <xsl:sort select="Article/Year" /> <xsl:sort select="Article/IssueNumber"/> <xsl:sort select="Article/Page" /> </xsl:apply-templates> </xsl:copy> </xsl:template> </xsl:stylesheet> that way attributes (like pofis) are copied trough and the child elements of List elements, the Item elements, are sorted on Article/Year, Article/IssueNumber, Artice/Page. The only change you probably need is to adapt the xsl:sort instructions to add the data type e.g. <xsl:sort select="Article/Page" data-type="number"/> -- Martin Honnen http://JavaScript.FAQTs.com/
|
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
|