Created
April 1, 2014 22:47
-
-
Save mamund/9924689 to your computer and use it in GitHub Desktop.
handling leading text nodes 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"> | |
My name is | |
<data name="name">Stephen</data> | |
</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"> | |
My name is | |
<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