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.

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.

Is this the correct approach for this process?

-----Original Message-----
From: J.Pietschmann [mailto:[EMAIL PROTECTED] 
Sent: terça-feira, 7 de Março de 2006 15:15
To: fop-users@xmlgraphics.apache.org
Subject: Re: Fonts

Andreia Oliveira wrote:
...
> An xml file, a xsd and a xslt were created.
Fortunately, schema definitions (XSD) are irrelevant for FOP.

> (Example: <field1>Here is my text. It will be 
> <strong>difficult</strong> to get it <em>formatted</em> 
> correctly</field1>)

> <xsl:template name="XMLContent">
This matches elements with the name "XMLContent". There are no such elements
in your source file, because XMLContent is a *type*, therefore this template
never triggered. In you case this makes not much of a difference, because
you basically want the default template behaviour anyway.
You can't match types unless you are using a XSLT2 processor.

> <xsl:apply-templates select="node()" /> <xsl:value-of select="text()" 
> />
    ^^^^^^^^^
This will duplicate the first text node of the element, because all child
nodes (including all text nodes) have already been processed by the
apply-templates above.

> <xsl:template match="//em/text() | //strong/text()">
You should never start a template match with a "//".

> <fo:inline>
> <xsl:if test="ancestor::em">
Matching multiple elements and then dispatching again inside a template is
considered bad style.

You should have written two templates:
<xsl:template match="em">
   <fo:wrapper color="rgb(0,255,0)">
      <xsl:apply-templates/>
   </fo:inline>
</xsl:template>

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

Note further that you should use fo:wrapper instead of fo:inline, unless you
really want to generate inline areas.

J.Pietschmann

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


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

Reply via email to