Skip to content

Instantly share code, notes, and snippets.

@mamund
Created April 1, 2014 22:51
Show Gist options
  • Save mamund/9924723 to your computer and use it in GitHub Desktop.
Save mamund/9924723 to your computer and use it in GitHub Desktop.
handling trailing text node in UBER w/ standard XSLT processing
<uber version="1.0">
<data name="description">
<data name="name">Stephen</data>
is my name.
</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">
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