Skip to content

Instantly share code, notes, and snippets.

@mamund
Last active August 29, 2015 13:57
Show Gist options
  • Save mamund/9923741 to your computer and use it in GitHub Desktop.
Save mamund/9923741 to your computer and use it in GitHub Desktop.
processing text nodes for UBER
<uber version="1.0">
<data name="description">
My name is
<data name="name">Stephen</data>
and it's Tuesday.
</data>
</uber>
<?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>
<div id="uber">
<span class="description">
My name is
and it's Tuesday.
<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