• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XSL Recurrsion on Delimited String

 
charu setia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am having a problem in XSLT. i am getting a string as Input in the form of: String = Part1#@#Part2#@#Part3

<xsl:call-template name= "parts">
<xsl:with-param name="inputString" select="$String"/>
</xsl:call-template>

</xsl:template>

<xsl:template name="parts">
<xsl:param name="inputString"/>
<xsl:variable name="currentVal" select="substring-before($inputString, '#@#')"/>
<xsl:variable name="restOfString" select="substring-after($inputString, '#@#')"/>
<xsl:variable name = "URL">
<xsl:value-of select = "concat('/bmfsweb/testbrocade/image/PS Addendums/',$currentVal,'.pdf')" />
</xsl:variable>
<xsl:if test = "$currentVal != '' " >
<xsl:call-template name="printablePDF">
<xsl:with-param name="insertURL" select="$URL"/>
</xsl:call-template>
</xsl:if>

<xsl:if test="$restOfString != ''">
<xsl:call-template name= "parts">
<xsl:with-param name="inputString" select="$restOfString"/>
</xsl:call-template>
</xsl:if>

</xsl:template>


<xsl:template name="printablePDF">
<xsl:param name="insertURL"/>
<fo:page-sequence content-width="90%" content-height="90%" background-image="{$insertURL}" background-repeat="paginate" master-reference="pdfPageSequence">
<fo:flow flow-name="xsl-region-body">
<fo:block />

</fo:flow>
</fo:page-sequence>

The problem is that once the "printablePDF" template is called, it never reaches restOfString code to call"Parts" template again, failing the recursion.
In printablePDF template, i am trying to get a file from a resource and append in existing docs. for first value it prints correctly but it never reaches the second and subsequent values from "String".

Please Help!

Thanks
Charu
 
g tsuji
Ranch Hand
Posts: 669
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The named template printablePDF as shown is not closed properly. The whole xsl document will fail. Other than that I see no apparent reason why it won't reach what you said: the second and subsequent values from "String".
 
charu setia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Again,

Sorry for the Type. I forgot to copy the closing XSL tag in this post. It is very much there in the code so that cannot be the reason. Moreover i am npot getting any error message. its that it is not going to the next value in the string.
 
g tsuji
Ranch Hand
Posts: 669
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case, I cannot help and I won't bother to ask further info except you take the initiative because that's where the problem resides.
 
g tsuji
Ranch Hand
Posts: 669
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a further note: check your background-repeat attribute value. "paginate" is not conformed to fo's schema.
 
g tsuji
Ranch Hand
Posts: 669
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... and then you have to look into fo further on what property applies to what formatting object. What now jumps to my mind is that content-width etc etc most appearing there are not fo:page-sequence object's properties.

All these mean the xslt does reach the second and subsequent values from "String" etc etc and output to an xsl-fo document. The error probably results from within the rendering engine where the proper formation of the xsl-fo document becomes of primary importance. The illusion comes from the process where the intermediate xsl-fo document is never being a subject matter to the scripter's interest for inspection. And I advance, it is important that your inspect the intermediate document if you want to ensure the final results being proper and a valid xsl-fo.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic