On Mar 7, 2006, at 19:26, Andreia Oliveira wrote:

Hi,

This new approach was attempted (separate templates as suggested).
The result is the text inside field1 is not touched at all (as before). It
remains as before without any tranformation.
It seems to me that fop is not even applying the template despite the fact
that the xml file as references to <em> and <strong> elements.

Just to get this straight: FOP never applies templates. That's the XSLT processor's job (Xalan, Saxon...).

Maybe I did not explain myself clearly about my purpose:
Inside one XML field (fo:block) some <em> and <strong> tags may appear. If so, fop, when generating the should generate the text inside the <em> and
<strong> tags in italic and bold.

Starting from something like:

<field>
  Unformatted text with some <em>italic</em> and
  <strong>bold</strong>, maybe some
  <strong><em>bold-italic</em></strong>, or even
  <em><strong>italic-bold</strong></em>?
</field>

Use this template for the 'field' nodes:

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

and the following two for the 'em' and 'strong' nodes:

<xsl:template match="em">
  <fo:wrapper font-style="italic">
    <xsl:apply-templates />
  </fo:wrapper>
</xsl:template>

<xsl:template match="strong">
  <fo:wrapper font-weight="bold">
    <xsl:apply-templates />
  </fo:wrapper>
</xsl:template>

would lead to the output (indented for readability)

<fo:block>
  Unformatted text with some
  <fo:wrapper font-style="italic">italic</
   and
  <fo:wrapper font-weight="bold">bold</
  , maybe some
  <fo:wrapper font-weight="bold">
    <fo:wrapper font-style="italic">bold-italic</
  </
  , or even
  <fo:wrapper font-style="italic">
    <fo:wrapper font-weight="bold">italic-bold</
  </
  ?
</

which FOP renders without any problems.

Should do the job nicely, unless there is another error hidden somewhere...

Cheers,

Andreas


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

Reply via email to