xsl-list
[Top] [All Lists]

Re: [xsl] default xsl files?

2007-10-10 17:35:44
On 10/10/07, Robert Koberg <rob(_at_)koberg(_dot_)com> wrote:
On Wed, 2007-10-10 at 16:35 -0700, Anthony Ettinger wrote:
I'm using docbook, and I have read up about PUBLIC identifiers, and
the /etc/xml/catalog file pointing to local DTDs.

I want to have the same basic functionality with xsl
files...basically, the docbook xsl files are in or around the same
path: /usr/share/xml/.../docbook/stylesheets/

however this path may change...depending on the box.

Any idea how I can dynamically (at the OS level) provide the XSL file
to use from within my script?

What I do (in a java/jaxp realm) is provide a 'fallback' URIResolver. A
URIResolver is a very simple interface to implement. You can set the
resolver on your TransformerFactory (to resolve xsl:import/xsl:include)
and on the Transformer (to resolve document function calls).

I construct it by passing a fallback directory. Then when the jaxp
transformation hits a xsl:import, xsl:include or document function call,
it goes to the resolver's 'resolve' method. This is automatically passed
two parameters:

href - An href attribute, which may be relative or absolute.
base - The base URI against which the first argument will be made
absolute if the absolute URI is required. (I don't think I have ever
used this param...)

In the resolve method you can see if the file exists, if not find it in
the fallback location.

best,
-Rob



Sounds like what I need -- just have to do it in Perl somehow.
re-implementing 'import' and 'include' via DOM methods on the xsl file perhaps?



-- 
Anthony Ettinger
Ph: 408-656-2473
var (bonita, farley) = new Dog;
farley.barks("very loud");
bonita.barks("at strangers");

http://chovy.dyndns.org/resume/
http://utuxia.com/consulting

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>