Reputation: 851
I dont know how to translate the guiLabel to strong in the html output I'm trying to get the following html
output:
<p>lorem 1</p>
<p>lorem ipsum <strong>dolore</strong> amet</p>
<p>lorem 3</p>
from the following xml:
<para>1</para>
<para>lorem ipsum <guiLabel>dolore</guiLabel> amet</para>
<para>3</para>
my xsl file:
<xsl:for-each select="./*">
<xsl:choose>
<xsl:when test=". instance of element(para)">
<p><xsl:value-of select="."/></p>
</xsl:when>
</xsl:choose>
</xsl:for-each>
Upvotes: 0
Views: 147
Reputation: 70618
Instead of doing a xsl:for-each
you should use a templated approach, with xsl:apply-templates
and then a separate template match for the elements you wish to change.
Try this XSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="para">
<p>
<xsl:apply-templates />
</p>
</xsl:template>
<xsl:template match="guiLabel">
<strong>
<xsl:apply-templates />
</strong>
</xsl:template>
</xsl:stylesheet>
Upvotes: 1