You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Alex McLintock <al...@my-deja.com> on 2000/10/25 15:44:27 UTC
Replacing elements
Hi folks,
This may demonstrate ignorance on my part so feel free to say "go read so and so document".
I have a single fo template which I want to fill in with an image and some text. Rather than generating a new fo file every time the previous developer loaded up the fo file using a DOMParser, - and used some fake tags such as "<Date/>" or "<parameterValue0/>".
These would then be replaced by their actuial values like:
replaceNode(doc.getElementsByTagName("parameterName0").item(0),
doc.createTextNode('Name of Parameter0'));
Or to change the image location
Element inlineGraphic = (Element)doc.getElementsByTagName("fo:inline-graphic").item(0);
inlineGraphic.setAttribute("href", imgURL);
All this worked with FOP 0.13
Is this still doable with the latest version of FOP?
I realise that inline-graphic has changed to external graphic, and that href has changed to src. I am worried about the fact that "<Date/>" and "<parameterName0/>" aren't in the fo namespace...
Is anyone doing this with an embedded FOP from cvs? or are you all just using it in the command line?
Alex
www.DiverseBooks.com www.zz9.org www.charming-underclothes.org.uk
www.SFLink.net www.inversity.co.uk
------------------------------------------------------------
--== Sent via Deja.com http://www.deja.com/ ==--
Before you buy.
Re: Replacing elements
Posted by Markus Holmberg <ma...@acc.umu.se>.
Hi Alex..
I have been using (almost) the same approach as you for a while now, and
with several different versions of FOP (up to the current in CVS now),
and it has always worked.
I need to simply change parts of text (but don't wan't to do the
XML/XSLT part again) so I have a serialized Document object which I
deserialize and search for nodes with a specific attribute (in my case I
named it "fid" for field id). This attribute can be added to for example
an fo:inline element. FOP will ignore unknown attributes (I'm not sure
if it's ok to add unknown attributes really, but it works).
An all this is embedded in a servlet.
Regards, Markus.
On Wed, Oct 25, 2000 at 06:44:27AM -0700, Alex McLintock wrote:
> Hi folks,
>
> This may demonstrate ignorance on my part so feel free to say "go read so and so document".
>
> I have a single fo template which I want to fill in with an image and some text. Rather than generating a new fo file every time the previous developer loaded up the fo file using a DOMParser, - and used some fake tags such as "<Date/>" or "<parameterValue0/>".
> These would then be replaced by their actuial values like:
>
> replaceNode(doc.getElementsByTagName("parameterName0").item(0),
> doc.createTextNode('Name of Parameter0'));
>
> Or to change the image location
>
> Element inlineGraphic = (Element)doc.getElementsByTagName("fo:inline-graphic").item(0);
> inlineGraphic.setAttribute("href", imgURL);
>
> All this worked with FOP 0.13
>
> Is this still doable with the latest version of FOP?
> I realise that inline-graphic has changed to external graphic, and that href has changed to src. I am worried about the fact that "<Date/>" and "<parameterName0/>" aren't in the fo namespace...
>
> Is anyone doing this with an embedded FOP from cvs? or are you all just using it in the command line?
>
> Alex
>
>
> www.DiverseBooks.com www.zz9.org www.charming-underclothes.org.uk
> www.SFLink.net www.inversity.co.uk
>
> ------------------------------------------------------------
> --== Sent via Deja.com http://www.deja.com/ ==--
> Before you buy.
>
--
Markus Holmberg | Give me Unix or give me a typewriter.
markush@acc.umu.se | http://www.freebsd.org/