Created
January 28, 2015 20:32
-
-
Save wallymathieu/e7ecb934cd2c1c6859fc to your computer and use it in GitHub Desktop.
xml to html xslt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet | |
version="1.0" xmlns="http://www.w3.org/TR/REC-html40" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<!--Licensed under the new BSD License.--> | |
<xsl:output encoding="utf-8" indent="yes" method="html" omit-xml-declaration="yes"/> | |
<xsl:template match="node()"> | |
<table> | |
<tr> | |
<th> | |
<xsl:value-of select="name()"/> | |
</th> | |
<!--</tr> | |
<tr>--> | |
<xsl:if test="@*"> | |
<xsl:for-each select="@*"> | |
<th> | |
<xsl:value-of select="name()"/> | |
</th> | |
<td> | |
<xsl:value-of select="."/> | |
</td> | |
</xsl:for-each> | |
</xsl:if> | |
<xsl:if test="node()"> | |
<td> | |
<xsl:for-each select="node()"> | |
<xsl:apply-templates select="."/> | |
</xsl:for-each> | |
</td> | |
</xsl:if> | |
</tr> | |
</table> | |
</xsl:template> | |
<xsl:template match="text()"> | |
<xsl:value-of select="."/> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment