[xsl] Inlining blocks in FO

Subject: [xsl] Inlining blocks in FO
From: "Mark Wilson" <mark@xxxxxxxxxxxx>
Date: Sat, 7 Mar 2009 07:55:28 -0700
I am trying to produce a PDF document formatted like:

Adobovs, Kivdul
Letters to the editor. Nov/Dec 2001 p.27 .
Philatelic news and views. Sep/Oct 2001 p.35; Sep/Oct 2002 p.11; Nov/Dec 2002 p.28; Jan/Feb 2003 p.24 .


My template file gives me:

Adobovs, Kivdul
Letters to the editor. Nov/Dec 2001 p.27 .
Philatelic news and views. Sep/Oct 2001 p.35 ;
Sep/Oct 2002 p.11 ;
Nov/Dec 2002 p.28 ;
Jan/Feb 2003 p.24 .

Can someone help me understand how to get the citation elements from articles with the same <Title> all on the same line? I think I need to process the entire node-set for "Philatelic news and views" simultaneously, but am not sure how to write that template.

My XSLT and XML files, much abbreviated but still functional, follow.
Thanks,
Mark
------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:fo="http://www.w3.org/1999/XSL/Format"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; exclude-result-prefixes="xs" version="2.0">
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="page">
<fo:region-body region-name="body" margin-top="0.5in" margin-bottom="1in" margin-left="0.5in" margin-right="0.5in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="page">
<fo:flow flow-name="body">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>



<xsl:template match="Heading"> <fo:block> <xsl:apply-templates/> </fo:block> </xsl:template>

<xsl:template match="Article">
<fo:block>
<xsl:choose>
<xsl:when test="Title = (preceding-sibling::Article/Title) [last()]">
<fo:wrapper>
&#160;<xsl:value-of select="IssueName"/>
&#160;<xsl:value-of select="Year"
/>
p.<xsl:value-of select=" Page"/>
</fo:wrapper>
</xsl:when>
<xsl:otherwise>
<fo:wrapper>
<xsl:apply-templates select="Title"/>
&#160;<xsl:value-of select="IssueName"/>
&#160;<xsl:value-of select="Year"
/>
p.<xsl:value-of select=" Page"/>
</fo:wrapper>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="Title = (following-sibling::Article/Title) [1]">
<xsl:text> ; &#160;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> .</xsl:text>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</xsl:template>


</xsl:stylesheet>
---------------------------------------------------
<List>
  <Item>
     <Heading entry="author">Adobovs, Kivdul   </Heading>
     <Article>
        <Title>Letters to the editor</Title>
        <IssueName>Nov/Dec</IssueName>
        <Year>2001</Year>
        <Page>27</Page>
     </Article>
     <Article>
        <Title>Philatelic news and views</Title>
        <IssueName>Sep/Oct</IssueName>
        <Year>2001</Year>
        <Page>35</Page>
     </Article>
     <Article>
        <Title>Philatelic news and views</Title>
        <IssueName>Sep/Oct</IssueName>
        <Year>2002</Year>
        <Page>11</Page>
     </Article>
     <Article>
        <Title>Philatelic news and views</Title>
        <IssueName>Nov/Dec</IssueName>
        <Year>2002</Year>
        <Page>28</Page>
     </Article>
     <Article>
        <Title>Philatelic news and views</Title>
        <IssueName>Jan/Feb</IssueName>
        <Year>2003</Year>
        <Page>24</Page>
     </Article>
  </Item>
</List>

Current Thread