Reputation: 1158
Using XSLT, I'd like to be able to transform this :
<doc>
<tag1>AAA</tag1>
Hello !
<tag2>BBB</tag2>
</doc>
into this :
<div class="doc">
<div class="tag1">AAA</div>
Hello !
<div class="tag2">BBB</div>
</div>
...but without specifying explicitly any tag name in the stylesheet (there are too many in the real world)
What would be the best way to do this ?
Upvotes: 1
Views: 506
Reputation: 5902
Something along the lines of
<xslt:template match="*">
<div class="{local-name()}">
<xsl:apply-templates />
</div>
</xslt:template>
Upvotes: 6