Hi all
I am trying to set a variable in XSLT 1.0 as follows
<xsl:variable name="by" select="Contributors/Contributor[Role='ReMixer']/Name | Attribution" />
The Idea is that if the Remixer Role does not exsit then the variable will take on the value of Attribution, however when testing it always takes on the value Attribution regardless.
any ideas why this happens and a solution?
update 1
This is currently what i've got working
<xsl:variable name="Remixer" select="Contributors/Contributor[Role='ReMixer']/Name" />
<xsl:variable name="by">
<xsl:choose>
<xsl:when test="$Remixer = ''">
<xsl:value-of select="Attribution"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$Remixer"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Would there be a shorter way of acheving the same results?
below is a copy of the xml doccument
<track>
<attribution>Various Artists</attribution>
<contributors>
<contributor primary="true">
<role>Recording Artist</role>
<name country="" birth-deathyear="" part3="Cosmic Gate" part2="" part1="">Cosmic Gate</name>
</contributor>
<contributor primary="true">
<role>ReMixer</role>
<name country="" birth-deathyear="" part3="Gary Gee" part2="" part1="">Gary Gee</name>
</contributor>
</contributors>
</track>
Thanks
Sam