On Dec 5, 2005, at 21:43, Clifton Craig wrote:

Hi,

I'm writing a report transform usinf XSLT for XSL-FO and I have some basic questions. What's the best way to code for multiple page sequences. For example I have some static content that I like to keep in the header and footers and I guess it doesn't matter but I'd like to reuse chunks of XML-FO for that purpose rather than replicating it to the result tree. What I mean
is I have some XSL for a page sequence that looks like this:

I'm unsure what exactly you mean, but I guess you could define parts of the static-content (the ones you're going to reuse) as xsl:variables --some maybe even in another, included/imported stylesheet to keep them separated for maintainability--, and insert them into the result tree using xsl:copy-of.

Say,

<xsl:variable name="static-one">
  <fo:block font-family="{$FONT-DEFAULT}">
    <fo:block text-align="center" font-size="12pt" font-weight="bold">
<!-- Be very careful about the below XPath expression, as it will not necessarily be evaluated in the same context it currently is... If the expression actually evaluates differently for different page-sequences, this can't be put in a global variable, IIC -->
      <xsl:value-of select="snapshot/title" />
    </fo:block>
  ...
</xsl:variable>

Then further on you can go:

<fo:page-sequence master-reference="snapshot-pages">
  <fo:static-content flow-name="header">
<!-- some dynamic static content, specific to *this* page- sequence -->
    <xsl:copy-of select="$static-one" />
  </fo:static-content>
...

Also, the following seems a little fishy, although I have way too little context here to form an accurate idea of why you're using named templates instead of matching ones.

<xsl:call-template name="group-headings">
  <xsl:with-param name="group" select="snapshot/data/group[1]"/>
</xsl:call-template>
<xsl:call-template name="column-headers">
  <xsl:with-param name="meta" select="/snapshot/data/meta"/>
</xsl:call-template>

I don't know exactly what happens to these parameters, but if I see this, it makes me think: "Why not use

<xsl:apply-templates select="snapshot/data/group[1]" />
<xsl:apply-templates select="/snapshot/data/meta" />

?"

If the column-headers template actually needs to applied to several different types of nodes (other than meta), you could redefine it from

<xsl:template name="column-headers">

to

<xsl:template match="meta | ... | ...">

<snip />
What bothers me even more is since I'm programmatically controlling new pages
is there a better way to handle this type of processing?

Can you explain a bit further what you mean by 'programmatically controlling new pages'? If we get to see a bit more, maybe we can offer you a better way...

Right now it looks like I'll have to keep a line count in my stylesheet to
detect when I should programmatically start new pages.

Why? Is the processor's page-breaking algorithm insufficient for some reason? Can't you use XSL-FO's break-* properties to control this?


HTH!

Cheers,

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to