aspose file tools*
The moose likes XML and Related Technologies and the fly likes XSL Recurrsion on Delimited String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSL Recurrsion on Delimited String" Watch "XSL Recurrsion on Delimited String" New topic
Author

XSL Recurrsion on Delimited String

charu setia
Greenhorn

Joined: Nov 01, 2007
Posts: 4
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

Joined: Jan 18, 2011
Posts: 512
    
    3
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

Joined: Nov 01, 2007
Posts: 4
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

Joined: Jan 18, 2011
Posts: 512
    
    3
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

Joined: Jan 18, 2011
Posts: 512
    
    3
Just a further note: check your background-repeat attribute value. "paginate" is not conformed to fo's schema.
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 512
    
    3
... 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XSL Recurrsion on Delimited String