I declare a variable but told 'no following siblings instructions has no effect'
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 6
- Joined: Fri Oct 19, 2012 1:20 am
I declare a variable but told 'no following siblings instructions has no effect'
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.
-
- Posts: 6
- Joined: Fri Oct 19, 2012 1:20 am
Re: I declare a variable but told 'no following siblings instructions has no effect'
OK, found out what I was doing wrong.
I was out of scope when trying to use variable outside of the 'when' where it was declared. Since I had no following statement inside the 'when' clause it was saying not used (in an odd way...)
I was out of scope when trying to use variable outside of the 'when' where it was declared. Since I had no following statement inside the 'when' clause it was saying not used (in an odd way...)

Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service