Error: Circular definition of variable ...
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Mon Jul 28, 2008 5:06 pm
Error: Circular definition of variable ...
Hi there!
In an XSL I have the following lines of code:
If I do a transformation with the related XML this error occurs:
The confusing thing is, if I change the definition of the variable 'numberOfRoundsToDisplayOnFirstPage' to the following code, everything is fine:
What is wrong here?
Thanks for your help,
phranck
In an XSL I have the following lines of code:
Code: Select all
<xsl:variable name="hasSecondPage">
<xsl:choose>
<xsl:when test="$numberOfRounds = $numberOfRoundsToDisplayOnFirstPage and $numberOfRounds > $maxNumberOfRoundsOnFirstPage">
<xsl:value-of select="true()"/>
</xsl:when>
<xsl:when test="($numberOfRoundsToDisplayOnFirstPage < ($numberOfRounds + 1)) and ($numberOfRounds != $numberOfRoundsToDisplayOnFirstPage)">
<xsl:value-of select="true()"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="false()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="numberOfRoundsToDisplayOnFirstPage" as="xs:integer">
<xsl:variable name="rounds" select="/tourmatchesreport/tourmatchesreportitem/numberOfRoundsToDisplayOnFirstPage" as="xs:integer"/>
<xsl:choose>
<xsl:when test="$hasSecondPage = true()">
<xsl:value-of select="$rounds"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$rounds + 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Code: Select all
SystemID: ~/Developer/theLeague/TennisFramework/tournamentMatchesReportRaster64.xsl
Description: Circular definition of variable hasSecondPage
Code: Select all
<xsl:variable name="numberOfRoundsToDisplayOnFirstPage" select="/tourmatchesreport/tourmatchesreportitem/numberOfRoundsToDisplayOnFirstPage" as="xs:integer" />
Thanks for your help,
phranck
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Error: Circular definition of variable ...
Post by sorin_ristache »
Hello,
The variable hasSecondPage was defined based on the variable numberOfRoundsToDisplayOnFirstPage which was defined based on hasSecondPage. This is a circular definition because the definition of hasSecondPage is based on itself. A definition in which the value of a variable is based on the value of the same variable is not allowed in XSLT.
Regards,
Sorin
The variable hasSecondPage was defined based on the variable numberOfRoundsToDisplayOnFirstPage which was defined based on hasSecondPage. This is a circular definition because the definition of hasSecondPage is based on itself. A definition in which the value of a variable is based on the value of the same variable is not allowed in XSLT.
Regards,
Sorin
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