Hello I am trying to transfer information from xsl to pdf, wherein need to check some value regarding display. For e.g. Display a logo only once to avoid repetitive logo in the pdf. I have added logic using a variable, but it seems there is an issue with the value in the variable, an extract of the code is below with comments:
<xsl:template name="show">
<xsl:variable name="display" select="false()"/>
<fo:block>
Fruits
</fo:block>
<xsl:for-each select="Fruits/Fruit">
<xsl:variable name="FruitType" select="type"/>
<xsl:choose>
<xsl:when test="not($display) and contains($FruitType, 'Ground')">
<fo:block>
<xsl:variable name="FilePath" select="/imagesDir"/>
<xsl:variable name="FullFileName" select="concat($FilePath,'\', $Fruits_Logo_ImageFile)"/>
<fo:external-graphic src="url(file:///{$FullFileName})" content-height="scale-to-fit" height="15pt" content-width="15pt"/>
Fruits
<xsl:variable name="display" select="true()"/><!-- The value is updated to true here -->
<xsl:value-of select="$display"/>
</fo:block>
</xsl:when>
</xsl:choose>
<fo:block>
<xsl:value-of select="$display"/>
<!-- The value is false here but was updated to true in the when block-->
<xsl:value-of select="name"/>
</fo:block>
I need to update the value of variable 'display' when its printed once but doesnt seem to be updated as it is false again in the block where i print the title. What could be possibly wrong or missing in this. Thanks for any input.