Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 27th, 2017, 02:42 PM
Authorized User
Points: 274, Level: 5
Points: 274, Level: 5 Points: 274, Level: 5 Points: 274, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 52
Thanks: 9
Thanked 0 Times in 0 Posts
Default How To Call Same Template Multiple Times Within a Template

Hello.

I have an XML file with parent tag <CLAIMCONTACT>that can appear n number of times. For each <CLAIMCONTACT> I need to generate a PDF file.

I'm using xslt and FO commands within my xml_pdf.fo file that reads the XML file. My final outcome from this xml_pdf.fo file is to always generate one PDF file. Then, for each occurrence of the <CLAIMCONTACT> tag, generate another copy of the same PDF along with a cover sheet in front.

Is this at all possible? Call xml_pdf.fo from within xml_pdf.fo to generate multiple copies of the PDF.

For example, if my XML file contains two <CLAIMCONTACT> tags, the output from xml_pdf.fo will be one PDF file with no cover sheet, then two of the same PDF file with the cover sheet as the first page.

Another idea I had was to print multiple copies of the PDF within the XSLT code, depending on the occurrences of <CLAIMCONTACT>.
Is there code available to do this?
I Googled it but could not find anything.
I current have the cover sheets printing correctly - one per <CLAIMCONTACT>.
Now I just need to get the PDF file that's generated from all the XML code for each cover sheet created.

Something else I'm trying to figure out is how to call/execute another fo file from within xml_pdf.fo.
Then within my <CLAIMCONTACT> <xsl:for-each ...> loop, I'll process the other fo file.
Here's my looping code:
Code:
<fo:simple-page-master master-name="disclaimer" page-height="27.94cm" page-width="21.59cm" margin-top="0.5cm" margin-bottom="1cm" margin- left="1cm" margin-right="1cm">
   <fo:region-body region-name="disclaimer"/>
</fo:simple-page-master>

      <!-- DEFINE PAGE SEQUENCE - (Attorney Cover Page(s)) -->
      <xsl:if test="/doc/EOB/CLAIMCONTACT/NUMBER[.!=''] and $varInfo='Y'">
        <xsl:for-each select="/doc/EOB/CLAIMCONTACT">
          <fo:page-sequence master-reference="disclaimer" force-page-count="no-force">
            <fo:flow flow-name="disclaimer">
              <fo:block xsl:use-attribute-sets="attributes_NYNF">
                <fo:block padding="0pt" font-size="1pt">
                </fo:block>
                <xsl:call-template name="tmpAttorneyCoverPage">
                  <xsl:with-param name="vFirmName">
                    <xsl:value-of select="COMPANY_NAME"/>
                  </xsl:with-param>
                </xsl:call-template>
              </fo:block>
            </fo:flow>
          </fo:page-sequence>
        </xsl:for-each>
      </xsl:if>
I'm thinking this will be my best solution if possible!

Any suggestions will be greatly appreciated!

Thanks,
Rita

Last edited by ritagr; February 27th, 2017 at 08:00 PM.
Reply With Quote
  #2 (permalink)  
Old February 28th, 2017, 01:20 PM
Authorized User
Points: 274, Level: 5
Points: 274, Level: 5 Points: 274, Level: 5 Points: 274, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 52
Thanks: 9
Thanked 0 Times in 0 Posts
Default

So after trying about thirty variations, I was able to get the code to work.
Instead of using <xsl:call-template> I changed it to <xsl:apply-template> with match="/doc" (so within the loop my XML code would be passed on to the template).
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use recursive apply vs call template FXYLDY XSLT 2 June 15th, 2010 02:57 PM
anyway to call a template with a lower precedence? ojasrege XSLT 3 November 30th, 2007 12:13 PM
Using Parameter to call another template mikevn123 XSLT 1 October 27th, 2006 04:08 PM
how to use call-template result in a test? briforge XSLT 6 February 13th, 2006 06:54 PM
import / call / template match Kabe XSLT 3 February 26th, 2004 11:31 AM



All times are GMT -4. The time now is 12:33 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.