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

Discussion in 'XML' started by Kourosh, May 19, 2006.

  1. Kourosh

    Kourosh Guest

    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, May 19, 2006
    #1
    1. Advertising

  2. 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
     
    Joe Kesselman, May 20, 2006
    #2
    1. Advertising

  3. 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
     
    Joe Kesselman, May 20, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. google 24/7
    Replies:
    0
    Views:
    396
    google 24/7
    Feb 18, 2006
  2. Replies:
    1
    Views:
    3,612
    A. Bolmarcich
    May 27, 2005
  3. iavian
    Replies:
    7
    Views:
    1,334
    Keith Thompson
    May 11, 2008
  4. timr
    Replies:
    2
    Views:
    119
    Robert Klemme
    Jan 20, 2009
  5. Replies:
    3
    Views:
    123
    Martin Honnen
    Sep 28, 2005
Loading...

Share This Page