Please bear with me, as I'm new to XSL....I've stumbled my way through what
you'll read below. I'm trying to create a new page for each <picture>,
however, the for-each only works with the <area>. When I use <area> the
resultant pdf works properly, but it is possible to have mulitple <picture>
elements for one <area>. I feel as though I've tried everything, using
multiple for-each loops, changing the names of the tags, using absolute
referencing, using // referencing.....any suggestions as to why this would
not be working?
Here's an excerpt of my XML...
<pb>
<section>
<sectionname>Overview</sectionname>
<area>
<areaname>Defects</areaname>
<picture>
<caption>Defect-12</caption>
<pictureurl>/autoproposal/25.jpeg</pictureurl>
<drawingurl>/autoproposal/LS-4-00_T_Joint.gif</drawingurl>
<height>4.50in</height>
<width>4.50in</width>
<defect>
<description>Deck-rusted</description>
<cause>Acids in air/ ext and int
moisture</cause>
<impact>Safety issues, debris getting into
machinery</impact>
<solution>Tear-off and lay another sheet of
deck on top</solution>
</defect>
</picture>
</area>
</section>
</pb>
Here's my XSL-FO...
<xsl:template match="pb">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="picturebook">
<fo:region-before
display-align="center"></fo:region-before>
<fo:region-body margin=".5in" />
</fo:simple-page-master>
</fo:layout-master-set>
<xsl:for-each select="descendant::area">
<fo:page-sequence master-reference="picturebook">
<fo:flow flow-name="xsl-region-body">
<fo:table>
<fo:table-column column-width="2.5in"
number-columns-repeated="2" />
<fo:table-column column-width="2in"
number-columns-repeated="1" />
<fo:table-body>
<xsl:apply-templates mode="header" />
<xsl:apply-templates mode="caption" />
<xsl:apply-templates mode="picture" />
<xsl:apply-templates mode="drawing" />
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
</fo:root>
</xsl:template>
<xsl:template match="pb" mode="header">
<xsl:apply-templates select="section" mode="header" />
</xsl:template>
<xsl:template match="section" mode="header">
<fo:table-row>
<fo:table-cell>
<fo:block space-before="12pt"><fo:inline
font-weight="bold"><xsl:text>Section: </xsl:text></fo:inline><xsl:value-of
select="sectionname" /></fo:block>
</fo:table-cell>
<fo:table-cell />
</fo:table-row>
</xsl:template>
<xsl:template match="pb" mode="caption">
<xsl:apply-templates select="picture" mode="caption" />
</xsl:template>
<xsl:template match="picture" mode="caption">
<fo:table-row>
<fo:table-cell>
<xsl:if test="string(caption)">
<fo:block space-before="12pt"><fo:inline
font-weight="bold"><xsl:text>Caption: </xsl:text></fo:inline><xsl:value-of
select="caption" /></fo:block>
</xsl:if>
</fo:table-cell>
<fo:table-cell />
</fo:table-row>
</xsl:template>
<xsl:template match="pb" mode="picture">
<xsl:apply-templates select="picture" mode="picture" />
</xsl:template>
<xsl:template match="picture" mode="picture">
<fo:table-row>
<fo:table-cell number-columns-spanned="2">
<fo:block>
<fo:external-graphic>
<xsl:attribute name="height">
<xsl:value-of select="height" />
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="width" />
</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="pictureurl" />
</xsl:attribute>
</fo:external-graphic>
</fo:block>
</fo:table-cell>
<fo:table-cell padding="6pt">
<xsl:if test="string(descendant::description)">
<fo:block font-weight="bold"
space-before="8pt">Description</fo:block>
<fo:block space-after="20pt"><xsl:value-of
select="descendant::description" /></fo:block>
<fo:block font-weight="bold">Cause</fo:block>
<fo:block space-after="20pt"><xsl:value-of
select="descendant::cause" /></fo:block>
<fo:block font-weight="bold">Impact</fo:block>
<fo:block space-after="20pt"><xsl:value-of
select="descendant::impact" /></fo:block>
</xsl:if>
</fo:table-cell>
</fo:table-row>
</xsl:template>
<xsl:template match="pb" mode="drawing">
<xsl:apply-templates select="picture" mode="drawing" />
</xsl:template>
<xsl:template match="picture" mode="drawing">
<fo:table-row>
<fo:table-cell>
<xsl:if test="string(descendant::solution)">
<fo:block font-weight="bold"
space-before="8pt">Solution</fo:block>
<fo:block><xsl:value-of
select="descendant::solution" /></fo:block>
</xsl:if>
</fo:table-cell>
<fo:table-cell number-columns-spanned="2">
<fo:block>
<fo:external-graphic>
<xsl:attribute name="height">
<xsl:value-of select="height" />
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="width" />
</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="drawingurl" />
</xsl:attribute>
</fo:external-graphic>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
Lisa Mychalishyn
Business Analyst
800-423-5667 ext. 249
_____________________________________________________________________
This message has been checked for all known viruses by a Third Party virus
scanning service. Please direct any questions or comments to
Helpdesk(_at_)Centimark(_dot_)com(_dot_)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list