RE: [xsl] XSL:FO Identify Transforms

Subject: RE: [xsl] XSL:FO Identify Transforms
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 16 Sep 2011 13:31:02 -0400
At 2011-09-16 18:17 +0100, Chris Booth wrote:
Based on this template:
<xsl:template match="node() | @*">
        <xsl:copy>
                <xsl:apply-templates select="@* | node()" />
        </xsl:copy>
</xsl:template>

I was trying to construct in FO, but not quite there. I feel I am missing your suggestion

That I think you cannot have a generic solution matching nodes regardless of their name.


Some of your XML constructs are block-level and some are inline-level.

So you need something explicitly recognizing your block-level constructs along the lines of:

  <fo:flow ...>
    <xsl:apply-templates/>
  </fo:flow>

  <xsl:template match=" thisblock | thatblock | otherblock ">
    <fo:block>
      <xsl:apply-templates/>
    </fo:block>
  </xsl:template>

You don't need a template rule for inline constructs, but you may want to introduce one if you want to decorate your inline content:

  <xsl:template match=" thisinline ">
     <fo:inline ....>
        <xsl:apply-templates/>
     </fo:inline>
  </xsl:template>

  <xsl:template match=" thatinline ">
     <fo:inline ....>
        <xsl:apply-templates/>
     </fo:inline>
  </xsl:template>

I'm not sure of the utility of your one-cell, one-row table direction you were headed. And your nested <xsl:for-each> won't achieve what you are looking for because that pull approach of two constructs only goes two levels deep in your structure.

The above push approach will address all the levels of your input XML.

I hope this helps.

. . . . . . . . . Ken


-- Contact us for world-wide XML consulting and instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread