Ok. I see where you're coming from.

But in my case I have hrefs mixed with plain text.

So my setTitle might look something like this.

setTitle(String_From_Properties);

I don't know exactly what that string is, but I know it might have hrefs.
So my XML, if I was creating one, would look like this:
<title>some text <a href="http://sample.com";>click</a> more text</title>

And the XSLT would be:
<xsl:template match="title">
  <xsl:apply-templates />
</xsl:template>

<xsl:template match="a">
 <fo:basic-link color="blue" external-destination="url([EMAIL PROTECTED])">
   <xsl:value-of select="."/>
 </fo:basic-link>
</xsl:template>

Since I'm matching <a> I would like it to be in the XML.
Now making it appear in the XML is solved.
When I create the FO from that XML it also works.
But when I skip the XML/FO and go straight from Obj to PDF, it gets written as text.

But I see your point.
In that case I would have to parse the string I'm getting from a properties file.
I was trying to avoid that.

Regards,

From: Andreas L Delmelle <[EMAIL PROTECTED]>
Reply-To: fop-users@xmlgraphics.apache.org
To: fop-users@xmlgraphics.apache.org
Subject: Re: embedding output escaping
Date: Thu, 28 Jul 2005 18:24:34 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Jul 28, 2005, at 16:56, Fabrizio Caldas wrote:

Hi,

I got the escape working for the XML, you're right about being in the XMLReader.java that I need to make this change.

In the first generateFor() method that I have I included a call to

handler.processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING,null);

This disables output escaping when creating the xml with the ExampleObj2XML.

But when I transform to PDF using the ExampleObj2PDF the escaping does not work.

Well, I still think you don't need to do any escaping (or disable escaping for that matter).

If you need to have:
<fo:basic-link external-destination="url">Click here</fo:basic-link>

There are two things to take into account:
- - our example embedding.tools.AbstractObjectReader doesn't activate namespace support
- - and it does not offer any support for attributes

You basically have two options:
1) modify the code for AbstractObjectReader to allow namespaces and attributes (or override the relevant methods in a subclass)
2) generate semantic XML from your object, then transform it via XSLT to FO

For 2), the scenario would look something like:
* use a method similar to setTitle() to set/store the strings for the destination URL and "Click here". For example store it in member variables named linkContent and linkDest (and provide getXXX() methods to retrieve them)

* then, in your XMLReader in the generateFor() method that will process your object, you create the result element roughly as follows:
...
handler.startElement("link");
handler.element("destination",obj.getLinkDest());
handler.element("content",obj.getLinkContent());
handler.endElement("link");
...

You will then get XML output like this:

<link>
  <destination>URL</destination>
  <content>Click here</content>
</link>

This fragment can be transformed by an XSL template:

<xsl:template match="link">
  <fo:basic-link external-destination="{destination}">
    <xsl:value-of select="content" />
  </fo:basic-link>
</xsl:template>

HTH!

Greetz,

AD
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFC6QbLyHTbFO9b8aARAvJjAKCMLiPYet/aCXFS7JBEg1RGBRf2GQCdHA74
+HKtu2LMlsYDDGy4KRKQ2XU=
=Gu0x
-----END PGP SIGNATURE-----


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


_________________________________________________________________
MSN Messenger: converse online com seus amigos . http://messenger.msn.com.br


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

Reply via email to