Fetching the url from a xsl sheet(xpath)

Discussion in 'XML' started by Taare, Apr 20, 2005.

  1. Taare

    Taare Guest

    I was thinking about a xsl sheet that could change template depending
    on the url, sort of like using $_GET with PHP. I'v heard that XSLT 2.0
    got the document() function, but I'v also heard that there is a trick
    for doing this with XSLT 1.0, anybody know?
     
    Taare, Apr 20, 2005
    #1
    1. Advertising


  2. > I'v heard that XSLT 2.0 got the document() function,


    document() is in XSLT 1.0 as well.
     
    David Carlisle, Apr 20, 2005
    #2
    1. Advertising

  3. Taare wrote:

    > I was thinking about a xsl sheet that could change template depending
    > on the url, sort of like using $_GET with PHP. I'v heard that XSLT 2.0
    > got the document() function, but I'v also heard that there is a trick
    > for doing this with XSLT 1.0, anybody know?


    XSLT (even 1.0) stylesheets take external parameters so you could pass
    the URL as a parameter to the XSLT processor.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Apr 20, 2005
    #3
  4. Taare

    Taare Guest

    I'm trying to figure out this external parameter thing, maybe you could
    show me a exsample? Also, I see that the document() function don't
    bring up an "unknow function" error, but it doesn't print the url for
    the element either, you got any thoughts about that?
     
    Taare, Apr 20, 2005
    #4
  5. Taare wrote:

    > I'm trying to figure out this external parameter thing, maybe you could
    > show me a exsample?


    As far as XSLT goes you simply do
    <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">

    <xsl:param name="parameterName" />

    ...
    </xsl:styleshet>
    to define the global external parameter. Then it depends on the XSLT
    processor and the API it has on how to set the parameter to a value
    before you run a transformation.



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Apr 20, 2005
    #5
  6. Taare

    Taare Guest

    Yeah, I figured that out, as I searched through this group. Right now
    I'm just testing stuff with the built in mozilla xslt
    engine(TransforMiiX), and it seems to not work. Thanks for all the help
    guys, and I'll be a good boy next time and search first then ask :)
     
    Taare, Apr 20, 2005
    #6
    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. Per Steffensen

    Fetching protected URL in tomcat

    Per Steffensen, Aug 14, 2003, in forum: Java
    Replies:
    0
    Views:
    434
    Per Steffensen
    Aug 14, 2003
  2. Alexander Farber
    Replies:
    6
    Views:
    468
    A. Farber
    Mar 12, 2006
  3. Replies:
    1
    Views:
    3,617
    A. Bolmarcich
    May 27, 2005
  4. David Jacques

    Fetching binary file linked in URL

    David Jacques, Nov 12, 2004, in forum: C++
    Replies:
    5
    Views:
    1,025
    David Jacques
    Nov 15, 2004
  5. shanti bhushan
    Replies:
    8
    Views:
    333
    Stefan Behnel
    May 18, 2010
Loading...

Share This Page