Last active
August 29, 2015 13:57
-
-
Save mamund/9920993 to your computer and use it in GitHub Desktop.
UBER nesting of text
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="prefix">My name is</data> | |
<data name="name">Stephen</data> | |
<data name="postfix">and it's Tuesday.</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"> | |
<span class="prefix">My name is</span> | |
<span class="name">Stephen</span> | |
<span class="postfix">and it's Tuesday.</span> | |
</span> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment