Re: sort problem
On Wednesday 04 September 2002 21:28, aruniima.chakrabarti@xxxxxxxxxxxxxxxxxx wrote: > Thanks David... but i still confused...if i do <xsl:apply-templates > select="@* | * | text()"> or <xsl:apply-templates select="@* | * | > node()">, the output doesnot contain any of the attributes. Please help in > getting the required output. The problem is probably that if you output attributes, they must be output immediately after the element to which they belong (you can't output any other elements or text before your attributes). Since you are sorting by the name() of the nodes, the text() nodes will always be output first, since the name of a text node is "#text". The hash mark (#) will be sorted alphabetically before the names of your attributes. The solution could be to apply-templates to attributes and other nodes separately. It doesn't make any sense to sort the output of attributes anyway (since attributes don't have any defined order). <xsl:template match="/ | @* | node()"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates select="node()"> <xsl:sort select="name()"/> </xsl:apply-templates> </xsl:copy> </xsl:template> Let me know if this solves your problem, and HTH. -- Peter Davis 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