[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: default xsl files?

Subject: Re: default xsl files?
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Wed, 10 Oct 2007 19:55:44 -0400
Re:  default xsl files?
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


> Also, there may be a case where I need to override a docbook xsl file
> but still use the other un-modified versions:
> 
> ie:
> 
> /my_files/foo.xsl (customized version)
> /distro_files/foo.xsl (original version)
> /distro_files/bar.xsl (original version)
> 
> So for example, if there is a "/my_files/foo.xsl" use that one,
> otherwise use the "/distro_files/" versions.
> 
> I realize this is may not specifically relate to XSLT (perhaps) but I
> do see how it is done with DTDs and XML, just need a similar mechanism
> for maintaining my stylesheets.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.