Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 12th, 2011, 10:52 AM
bug bug is offline
Registered User
 
Join Date: Feb 2011
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSL:FO tag for repetetive child node

Hi all,

I trying to transform the xml to pdf using the xsl:fo.

I am new to this..i got stucked at one tag which should pull all the repetive child elements with in the parent element..

eg:

<sop_content>
<method_content>
<main_content/>
<main_image/>
<main_image/>
<main_image/>
</method_content>
<method_content>
<main_content/>
<main_image/>
<main_image/>
<main_image/>
</method_content>
</sop_content>

from the above xml..for each method_content i have to copy all the main_image elements into one coulmn..

for that i am using this code:

<xsl:for-each select="/sop_content/method_content">
<fo:table-row >
<fo:table-cell>
<fo:block>
<xsl:apply-templates select="main_content"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:apply-templates select="main_image"/>
</fo:block>
</fo:table-cell>

</fo:table-row>

</xsl:for-each>

<xsl:template match="main_content">
<xsl:apply-templates select="./*"/>
</xsl:template>

<xsl:template match="main_image">
<xsl:variable name="imageURI"><xsl:value-of select="./node()"/></xsl:variable>
<xsl:if test="string-length($imageURI)>0">
<xsl:variable name="imgSrc"><xsl:value-of select="." /></xsl:variable>

<fo:external-graphic src="url({concat($pathToGraphics,'/',$imgSrc)})" content-width="scale-to-fit" content-height="scale-to-fit" width="6.25in"/>
</xsl:if>
</xsl:template>


but i am not able to get all the images in the pdf after getting transformed. Only the first image is visible on the pdf.

Can any of you suggest me which condition needs to be used to get all the images on the pdf.. Thanks in advance..

bug
 
Old July 22nd, 2011, 06:46 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Try changing this line:

Code:
<xsl:value-of select="./node()"/>
to
Code:
<xsl:value-of select="."/>





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to include mathml in xsl fo using xsl transformation [email protected] XSLT 0 July 9th, 2011 07:20 AM
how to find child node when there is mentioned (child::*) mlohokare XSLT 3 May 12th, 2009 12:40 PM
Accessing a node bases on child node value musman0047 XSLT 1 February 27th, 2009 12:26 PM
The reference node is not a child of this node.XSL XMLUser XSLT 2 February 25th, 2008 05:22 AM
problem with empty block tag in xsl-fo and fop enT XSLT 0 October 14th, 2003 08:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.