Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - possible to use an environmental variable to address the XSL file path?

 
Thread Tools Search this Thread
Old 05-19-2006, 11:15 PM   #1
Default possible to use an environmental variable to address the XSL file path?


I'm just wondering, is there a way I could use an environmental
variable in an XML file to specify the path of its XSL file? something
like

<?xml-stylesheet type="text/xsl" href="%test%\test.xsl" ?>



Kourosh
  Reply With Quote
Old 05-20-2006, 04:15 AM   #2
Joe Kesselman
 
Posts: n/a
Default Re: possible to use an environmental variable to address the XSLfile path?

Kourosh wrote:
> I'm just wondering, is there a way I could use an environmental
> variable in an XML file to specify the path of its XSL file?


XSLT itself can't access the system's environmental variables.

The usual solution is to use your XSLT processor's command-line options
(or API, if you're invoking it from another program) to pass the value
of the environment variable in as a stylesheet parameter. The exact
syntax varies depending on the processor.

Alternatively, you could write an extension function that retrieves
environment variable values. But that might have to be recoded if you
ever want to run on another processor.


--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
  Reply With Quote
Old 05-20-2006, 04:35 AM   #3
Joe Kesselman
 
Posts: n/a
Default Re: possible to use an environmental variable to address the XSLfile path?

.... Oh. I misread. You want to use the variable in the path to find the
stylesheet in the first place.

The simple answer to that one is "no, or at least you can't count on
it". The more complicated answer is that this is a question of how the
specific tool (browser or whatever) interprets that processing
instruction. Some may let a user/developer plug in code that can help
them process URIs (a "URI Resolver"); others may have other ways of
handling this; others will simply not handle it.

But this inability to implicitly/automatically retrieve environment
variables is probably a Good Thing. I don't _want_ downloaded files
accessing anything else on my system unless I explicitly give them
permission to do so; that would be a security/privacy issue.


--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump