|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: re-ordering nodes/partial sort
Hey Kevin,
Does this have to be in document order of the input (or based on an index of some sort) or is this something that can solved simply by using the sort element? Something as simple as this... <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <supplements> <xsl:apply-templates select="supplements/supp"> <xsl:sort select="supp-desc"/> </xsl:apply-templates> </supplements> </xsl:template> <xsl:template match="supp"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> Will give you this... <?xml version="1.0" encoding="UTF-8"?>
<supplements>
<supp>
<supp-desc>Balcony</supp-desc>
<supp-price>8.00</supp-price>
</supp>
<supp>
<supp-desc>Bed & Breakfast</supp-desc>
<supp-price>4.00</supp-price>
</supp>
<supp>
<supp-desc>Bed & Breakfast (child)</supp-desc>
<supp-price>2.00</supp-price>
</supp>
<supp>
<supp-desc>Full Board</supp-desc>
<supp-price>60.00</supp-price>
</supp>
<supp>
<supp-desc>Full Board (child)</supp-desc>
<supp-price>30.00</supp-price>
</supp>
<supp>
<supp-desc>Half Board</supp-desc>
<supp-price>30.00</supp-price>
</supp>
<supp>
<supp-desc>Half Board (child)</supp-desc>
<supp-price>15.00</supp-price>
</supp>
<supp>
<supp-desc>Sea View</supp-desc>
<supp-price>10.00</supp-price>
</supp>
</supplements>But it seems that you have a requirement to sort based on doc order as well? Let me know if this is sufficient or if you need further help. The indexed solution is pretty straight forward as well but if this works, no need to further complicate the code if you don't have to. Best regards, <M:D/> Kevin Bird wrote: Hi
|
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
|

Cart








