Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
XML
XSL newbie question
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Martin Honnen, post: 778395"] Here is a solution, you can use the XPath function local-name() to get the name of an element to put that in the header and you can use modes to elegantly process the "field" elements twice, once for making the thead, once for filling the data in the tbody. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="[URL]http://www.w3.org/1999/XSL/Transform[/URL]" version="1.0"> <xsl:output method="html" indent="yes" /> <xsl:template match="resultdata"> <table> <thead> <tr> <xsl:apply-templates select="row[1]/*" mode="head-cells" /> </tr> </thead> <tbody> <xsl:apply-templates select="row" /> </tbody> </table> </xsl:template> <xsl:template match="*" mode="head-cells"> <th><xsl:value-of select="local-name()" /></th> </xsl:template> <xsl:template match="row"> <tr> <xsl:apply-templates select="*" mode="body-cells" /> </tr> </xsl:template> <xsl:template match="*" mode="body-cells"> <td><xsl:value-of select="." /></td> </xsl:template> </xsl:stylesheet> [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
XML
XSL newbie question
Top