Skip to content

Commit

Permalink
Normalize element names to match class value
Browse files Browse the repository at this point in the history
  • Loading branch information
jelovirt committed Sep 4, 2015
1 parent c302df5 commit f8bea59
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions xsl/normalize.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,20 @@

<xsl:template match="*[number(@ditaarch:DITAArchVersion) &lt; 1.3]/@cascade"/>

<xsl:template match="*" priority="-5">
<xsl:template match="*[@class]" priority="-5">
<xsl:element name="{tokenize(tokenize(normalize-space(@class), '\s+')[last()], '/')[last()]}"
namespace="{namespace-uri()}">
<xsl:apply-templates select="node() | @*"/>
</xsl:element>
</xsl:template>

<xsl:template match="*" priority="-10">
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:apply-templates select="node() | @*"/>
</xsl:element>
</xsl:template>

<xsl:template match="node() | @*" priority="-10">
<xsl:template match="node() | @*" priority="-15">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
Expand Down

0 comments on commit f8bea59

Please sign in to comment.