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

RE: conditional inlcudes -is it possible?

Subject: RE: conditional inlcudes -is it possible?
From: Vedu Hariths <vhariths@xxxxxxxxx>
Date: Tue, 1 Oct 2002 09:38:32 -0700 (PDT)
vedu
Thanks, that helps.
Vedu
--- Robert Koberg <rob@xxxxxxxxxx> wrote:
> Hi,
> 
> You can't do it in XSL. But you can do it with a
> URIResolver in something like
> java. You can pass the arguments you need to the
> object and determine which file
> to include. For examplpe:
> 
> TransformerFactory factory =
> TransformerFactory.newInstance();
> factory.setURIResolver(new
> MyResolver(some_argument));
> ...
> 
> class MyResolver implements URIResolver {
>   String arg;
> 
>   public MyResolver(String _arg) {
>     this.arg = _arg;
>   }
> 
>   public Source resolve(String href,String base) {
>     String file_str = "some starting path";
>     if (href.equals("boo")
>       file_str = file_str;
>     } else if (href.equals("foo")) {
>       file_str = file_str + this.arg;
> 	}
>     File file = new File(file_str,href);
> 	if(file.exists()) return new StreamSource(file);
> 	return null;
>   }
> }
> 
> You set the resolver on the factory and then things
> like xsl:include/import and
> document() are handled by 'MyResolver'
> 
> best,
> -Rob
> 
> 
> 
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On
> Behalf Of Vedu Hariths
> > Sent: Monday, September 30, 2002 1:21 PM
> > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> > Subject:  conditional inlcudes -is it
> possible?
> >
> >
> > Hello,
> > This is our situation. We have a global xsl that
> > ensures that all our webpages have a certain
> content.
> > We are trying to make the inclusion of local xsl
> > stylesheets conditional based on where the request
> is
> > coming from so this brings out two questions:
> > a) is there a function like say HTTP_REFERER (in
> php)
> > that tells you the page/uri that requested the
> page
> > and,
> > b) is there a way to include different XSL
> stylesheets
> > into one XSL stylesheet based on the information
> from
> > 'a'.
> >
> > I do know that multiple includes are possible, but
> > when I tried this, as a first step, this also did
> not
> > work:
> >
> > <xsl:variable
> > name="location">http://theurl</xsl:variable>
> > </xsl:include href="$location" />
> >
> > This came out with the error that no stylesheet
> has
> > been speficied. This part would be necessary if
> 'a'
> > and 'b' could be done.
> >
> > Thanks for your help in advance,
> > Vedu
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > New DSL Internet Access from SBC & Yahoo!
> > http://sbc.yahoo.com
> >
> >  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> >
> 
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.