Can we do sorting in XSL ? how do you deal sorting columns
dynamically in XML.
Answer / Najir Husen
Yes, we can sort data in XSL using the xsl:sort element. The xsl:sort element sorts nodes of a specific template based on their attribute or content. To handle dynamic sorting columns, you can add multiple xsl:sort elements with different attributes 'name' (for column name) and 'order' (for ascending or descending order) within the same xsl:template. For example:nn<xsl:template match="/">n <table border="1">n <xsl:for-each select="./*[1]">n <xsl:sort name={local-name()}n xsl:if test="./@sort" select=".@sort/text()" order="{./@sort/@order}"/>n <tr><th><xsl:value-of select=local-name()/></th>n <xsl:apply-templates select="./"/>n </tr>n </xsl:for-each>n </table>n</xsl:template>
| Is This Answer Correct ? | 0 Yes | 0 No |
Can we use xml as database?
What are xml entities used for?
Tell me can we use graphics in xml?
What is xml tag library?
What is XML Namespace?
Give a few examples of types of applications that can benefit from using XML.
Can we debug xml file?
what is difference between mail sendig in .net 1.1 and .net 2.0
How do I run an xml file?
What are the elements of xml?
How to use filtering function in XSLT?
What are the various advantages of xsl?