This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: variable import hrefs?


Bob Stayton writes:
> > From: Mark Johnson <mark@phy.duke.edu>
> > 
> > Hi All,
> > 
> > For xsl stylesheets, is there a way to set import hrefs at runtime?
> > 
> > i.e. something having this effect:
> > 
> >   <xsl:import href="{$my_stylesheet_home}/xhtml/docbook.xsl"/>
> > 
> 
> I don't think so.  The <xsl:import> href attribute is
> defined in the XSLT Recommendation as a URI reference.
> URIs can be relative or absolute, but it doesn't say
> anthing about them being variable. 8^)
> 

By "variable", I mean that the _value_ of the URI is set by some
variable.

I'm trying to see if there's a way that users can specify what the
system stylesheets import via some parameter, environment variable, whatever. 

An example would be using the website stylesheets, but having them
import the v1.24 xsl stylesheets instead of the v1.29. The former
works with XT, the latter doesn't.

> Did you try it?
>
Oh yes. Many ways.

The XSLT rec seems to say that only a select few xsl:stylesheet
elements can use variables to set their attributes, and that
xsl:import isn't one of them. Norm will know.


> XSLT can generate attribute values in a result tree
> (document).  You could do a two-step process, where you
> first generate your formatting stylesheet using another
> "generate-stylesheet.xsl" template operating on a small XML
> configuration file containing your parameters.  The output
> of the first step would be your formatting stylesheet with
> the href's filled in.  They you would use that in a second
> XSLT process on your document.  If you can keep
> all that straight, it should work.  

Cool idea. I only wish I'd thought of it.:) 

Seems a little resource intensive, but will do the trick. 
I'll have to give it a try.

> Or you could just run
> a simple filter script on your stylesheet before applying it.
> 

Yeah, right. 


Thanks for the tips, Bob!

Mark


> bobs
> Bob Stayton                                 400 Encinal Street
> Publications Architect                      Santa Cruz, CA  95060
> Technical Publications                      voice: (831) 427-7796
> The Santa Cruz Operation, Inc.              fax:   (831) 429-1887
>                                             email: bobs@sco.com
> 
> ------------------------------------------------------------------
> To unsubscribe from this elist send a message with the single word
> "unsubscribe" in the body to: docbook-apps-request@lists.oasis-open.org

------------------------------------------------------------------
To unsubscribe from this elist send a message with the single word
"unsubscribe" in the body to: docbook-apps-request@lists.oasis-open.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]