Created
April 1, 2014 22:51
-
-
Save mamund/9924723 to your computer and use it in GitHub Desktop.
handling trailing text node in UBER w/ standard XSLT processing
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
<uber version="1.0"> | |
<data name="description"> | |
<data name="name">Stephen</data> | |
is my name. | |
</data> | |
</uber> |
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:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="xml" indent="yes"/> | |
<xsl:template match="node()"> | |
<xsl:apply-templates select="node()" /> | |
</xsl:template> | |
<xsl:template match="uber"> | |
<div id="uber"> | |
<xsl:apply-templates select="node()" /> | |
</div> | |
</xsl:template> | |
<xsl:template match="data"> | |
<span class="{@name}"> | |
<xsl:copy-of select="text()" /> | |
<xsl:apply-templates select="node()" /> | |
</span> | |
</xsl:template> | |
</xsl:stylesheet> |
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
<div id="uber"> | |
<span class="description"> | |
is my name. | |
<span class="name">Stephen</span></span> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment