Note that there are some explanatory texts on larger screens.

plurals
  1. POxslt value-of union priority
    primarykey
    data
    text
    <p>I am trying to set a variable in XSLT 1.0 as follows </p> <pre><code> &lt;xsl:variable name="by" select="Contributors/Contributor[Role='ReMixer']/Name | Attribution" /&gt; </code></pre> <p>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.</p> <p>any ideas why this happens and a solution?</p> <p>update 1</p> <p>This is currently what i've got working</p> <pre><code>&lt;xsl:variable name="Remixer" select="Contributors/Contributor[Role='ReMixer']/Name" /&gt; &lt;xsl:variable name="by"&gt; &lt;xsl:choose&gt; &lt;xsl:when test="$Remixer = ''"&gt; &lt;xsl:value-of select="Attribution"/&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;xsl:value-of select="$Remixer"/&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:variable&gt; </code></pre> <p>Would there be a shorter way of acheving the same results?</p> <p>below is a copy of the xml doccument</p> <pre><code>&lt;track&gt; &lt;attribution&gt;Various Artists&lt;/attribution&gt; &lt;contributors&gt; &lt;contributor primary="true"&gt; &lt;role&gt;Recording Artist&lt;/role&gt; &lt;name country="" birth-deathyear="" part3="Cosmic Gate" part2="" part1=""&gt;Cosmic Gate&lt;/name&gt; &lt;/contributor&gt; &lt;contributor primary="true"&gt; &lt;role&gt;ReMixer&lt;/role&gt; &lt;name country="" birth-deathyear="" part3="Gary Gee" part2="" part1=""&gt;Gary Gee&lt;/name&gt; &lt;/contributor&gt; &lt;/contributors&gt; &lt;/track&gt; </code></pre> <p>Thanks</p> <p>Sam</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload