RE: [xsl] XSLT File I/O?

Subject: RE: [xsl] XSLT File I/O?
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Thu, 17 Feb 2005 08:14:32 -0000
> Hi,
> I am doing a bunch of XSL transformations from an XML file
> using Cocoon and finally generate a FO file.
> I have the following requirement to carry out in my XSL
> transformations: 1. Get the fileurl for images in the XML
> (e.g. /images/A.jpg) 2. Check for the file on a physical
> location 3. If the file exist then ok, otherwise change the
> file url (/images/A_temp.jpg).
> I have not used File I/O using XSL and am not even sure if
> that's possible.
> Can someone please throw some light on this ?
> Is it possible to fulfill the above requirement using XSL?
> Are there any other ways to do this using Cocoon?

If it's possible (I don't know anything about Cocoon) I would write an
XMLFilter that would sit between the XML parser and the transformation.
As the SAX events come through you could check the img/@src to see if
the file exists, and then add a custom attribute 'exists="true"' to the
element (well, to the Attributes object that goes in the call to
super.startElement()).  Then all you need to do is check for the @exists
attribute in your stylesheet.


Current Thread