I declare a variable but told 'no following siblings instructions has no effect'
Posted: Wed Nov 28, 2012 2:53 am
Hi,
I can declare a variable containing a sequence of strings and use it as parameter to a template like so:
This above works fine, but when I put the same thing inside a choose statement like so:
I get warning for each 'variable' line of
What am I doing wrong?
Am I not allowed to set a variables content based on a condition or am I just going about it the wrong way?
Thanks,
Bryce S.
I can declare a variable containing a sequence of strings and use it as parameter to a template like so:
Code: Select all
<xsl:variable name="Gaits" as="xs:string*" select="('Trot')"/>
<xsl:apply-templates select="Sires">
<xsl:with-param name="Gaits" select="$Gaits"></xsl:with-param>
</xsl:apply-templates>
Code: Select all
<xsl:choose>
<xsl:when test="$Val = 'P'">
<xsl:variable name="Gaits" as="xs:string*" select="('Pace')"/>
</xsl:when>
<xsl:when test="$Val = 'T'">
<xsl:variable name="Gaits" as="xs:string*" select="('Trot')"/>
</xsl:when>
<xsl:when test="$Val = 'C'">
<xsl:variable name="Gaits" as="xs:string*" select="('Pace', 'Trot')"/>
</xsl:when>
</xsl:choose>
and consequently when I try to use it in the 'apply-templates' call it says my variable 'Gaits' has not been declared.[Saxon-PE 9.4.0.3] A variable with no following sibling instructions has no effect
What am I doing wrong?
Am I not allowed to set a variables content based on a condition or am I just going about it the wrong way?
Thanks,
Bryce S.