G
GIMME
Short version of question ...
An xml file contains the following line ...
<input type="label" text="fasdfad" css_tag="h1" />
The task is to convert it into
<h1>fasdfad</h1>
But to do the conversion in such a way that the possible values for
css_tag do not have to be enumerated in the xsl file.
Something like :
<xsl:template match="input">
<xsl:choose>
<xsl:when test="@type='label'">
<<xsl:value-of select="@css_tag"/>>
<xsl:value-of select="@text"/>
<<xsl:value-of select="@css_tag"/>/>
</xsl:when>
</xsl:choose>
</xsl:template>
This however, isn't well formated XML.
The enumerated solution goes something like :
xsl:template match="input">
<xsl:choose>
<xsl:when test="@type='label'">
<xsl:when test="@css_tag='h1'">
<h1><xsl:value-of select="@text"/></h1>
</xsl:when>
<xsl:when test="@css_tag='h2'">
<h2><xsl:value-of select="@text"/></h2>
</xsl:when>
</xsl:when>
</xsl:choose>
</xsl:template>
Any ideas?
An xml file contains the following line ...
<input type="label" text="fasdfad" css_tag="h1" />
The task is to convert it into
<h1>fasdfad</h1>
But to do the conversion in such a way that the possible values for
css_tag do not have to be enumerated in the xsl file.
Something like :
<xsl:template match="input">
<xsl:choose>
<xsl:when test="@type='label'">
<<xsl:value-of select="@css_tag"/>>
<xsl:value-of select="@text"/>
<<xsl:value-of select="@css_tag"/>/>
</xsl:when>
</xsl:choose>
</xsl:template>
This however, isn't well formated XML.
The enumerated solution goes something like :
xsl:template match="input">
<xsl:choose>
<xsl:when test="@type='label'">
<xsl:when test="@css_tag='h1'">
<h1><xsl:value-of select="@text"/></h1>
</xsl:when>
<xsl:when test="@css_tag='h2'">
<h2><xsl:value-of select="@text"/></h2>
</xsl:when>
</xsl:when>
</xsl:choose>
</xsl:template>
Any ideas?