xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Delmelle <andreas.delme...@telenet.be>
Subject Re: formatting stricture differing from data structure?
Date Fri, 09 May 2008 16:37:50 GMT
On May 9, 2008, at 17:58, paul womack wrote:

Hi

Just a note: for pure XSLT-related questions, you're always better  
off posting on Mulberry's XSLT list.

We try to make it a policy to point this out: this is a list for  
questions about using FOP.

No problem this time, but try to keep this in mind for the future.
We just want to avoid everyone posting their XSLT-questions here.  
Thanks!

Now, to answer your questions:

> A couple of questions have now occurred to me,
> which a reading the Tidwell book
> hasn't answered (easily).
>
> If my feed xml (in DTD form) were:
>
> <!ELEMENT data (heading, summary?, paragraph+)>
>
> How could I (best) get a single fo element around
> any summary (if present) and all the paragraphs?

To get one block that contains the summary and all paragraphs:

<xsl:template match="data">
   ...
   <fo:block>
     <xsl:apply-templates select="summary | paragraph" />
   </fo:block>
   ...
</xsl:template>

> Or in
>
> <!ELEMENT poem (title,verse+)>
>
> How could I get the first verse to be formatted
> differently to the rest?

One alternative would be:

<xsl:template match="verse">
   <xsl:choose>
     <xsl:when test="not(preceding-sibling::verse)">
       <fo:block xsl:use-attribute-sets="first-verse">
         <xsl:apply-templates />
       </fo:block>
     </xsl:when>
     <xsl:otherwise>
       <fo:block xsl:use-attribute-sets="other-verses">
         <xsl:apply-templates />
       </fo:block>
     </xsl:otherwise>
   </xsl:choose>
</xsl:template>


HTH!

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message