G
gwoodhouse
Hello,
I'm trying to transform XML that can come in server forms,
The XML i get is along these lines (This is example simplified code)
<composer>
<composer_if>jim</composer_if>
<composer_epithet>mr</composer_epithet>
</composer>
or
<artist>
<artist_if>bob</artist_if>
<artist_epithet>sir</artist_epithet>
</artist>
(or any number of different permutations of this)
I'm trying to use this code to display it in the form Mr, Jim or Sir,
Bob:
<xsl:template match="advertiser|artist|box_office|company|composer|
distributor|editor|for_benefit_of|lessee|owner|premises_owner|
producer_director|scenery_designer|signatory">
<xsl:choose>
<xsl:when test="main[@display = 'yes']">
<xsl:apply-templates select="main"/>
</xsl:when>
<xsltherwise>
<xsl:variable name="if">
<xsl:value-of select="name()"/><xsl:text>_if</xsl:text>
</xsl:variable>
<xsl:variable name="epithet">
<xsl:value-of select="name()"/><xsl:text>_epithet</xsl:text>
</xsl:variable>
<xsl:apply-templates select="$if"/>, <xsl:apply-templates
select="$epithet"/>
</xsltherwise>
</xsl:choose>
<xsl:apply-templates/>
</xsl:template>
But the XSLT proccessor doesn't like using variable's in its "select"
attribute.
Does anyone know a way around this without changing the XML being
passed in?
Thanks
Graeme
I'm trying to transform XML that can come in server forms,
The XML i get is along these lines (This is example simplified code)
<composer>
<composer_if>jim</composer_if>
<composer_epithet>mr</composer_epithet>
</composer>
or
<artist>
<artist_if>bob</artist_if>
<artist_epithet>sir</artist_epithet>
</artist>
(or any number of different permutations of this)
I'm trying to use this code to display it in the form Mr, Jim or Sir,
Bob:
<xsl:template match="advertiser|artist|box_office|company|composer|
distributor|editor|for_benefit_of|lessee|owner|premises_owner|
producer_director|scenery_designer|signatory">
<xsl:choose>
<xsl:when test="main[@display = 'yes']">
<xsl:apply-templates select="main"/>
</xsl:when>
<xsltherwise>
<xsl:variable name="if">
<xsl:value-of select="name()"/><xsl:text>_if</xsl:text>
</xsl:variable>
<xsl:variable name="epithet">
<xsl:value-of select="name()"/><xsl:text>_epithet</xsl:text>
</xsl:variable>
<xsl:apply-templates select="$if"/>, <xsl:apply-templates
select="$epithet"/>
</xsltherwise>
</xsl:choose>
<xsl:apply-templates/>
</xsl:template>
But the XSLT proccessor doesn't like using variable's in its "select"
attribute.
Does anyone know a way around this without changing the XML being
passed in?
Thanks
Graeme