Re: dynamic generate the document() function

Discussion in 'XML' started by Marrow, Jul 7, 2003.

  1. Marrow

    Marrow Guest

    Hi Jens,

    "Jens Heinrich" <> wrote in message
    news:be9meq$g89$07$-online.com...
    > I have some problem.
    > The document() Function with fix parameter works very well:
    >
    > <xsl:value-of select="document('test.xml')//Name/FirstName"/>
    >
    > ...but I have the path of the context node and want to set this path
    > dynamicly to this
    > function.
    > The path are saved in the variable xpath.
    >
    > I want to build some statement like:
    > <xsl:value-of select="document('test.xml') + $xpath"/> (perhaps, the
    > "+"doesn't work)
    > to get the value of the node.
    >
    > <xsl:value-of select="document(('test.xml'),$xpath) "/> doesn't work.
    >


    Firstly, this has nothing to do with the document() function really.

    None of what you are trying will work - there is no syntax for doing this
    because it cannot be done in XSLT+XPath. IOW, XSLT and XPath cannot macro
    evaluate a string as an XPath expression.

    However, some transformation engines do have extension functions that might
    enable you to do this (e.g. the evaluate() extension function in some
    engines) - but of course this makes the XSLT code less portable.

    Cheers
    Marrow
    http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
    http://www.topxml.com/Xselerator
     
    Marrow, Jul 7, 2003
    #1
    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. Weng Tianxiang
    Replies:
    5
    Views:
    1,317
    Christophe
    Feb 16, 2006
  2. Steve Carrow
    Replies:
    0
    Views:
    551
    Steve Carrow
    Jul 28, 2003
  3. Steve Carrow
    Replies:
    0
    Views:
    624
    Steve Carrow
    Jul 28, 2003
  4. Replies:
    3
    Views:
    415
    red floyd
    Apr 7, 2006
  5. Harlan Messinger
    Replies:
    2
    Views:
    2,304
    John Bell
    Mar 28, 2010
Loading...

Share This Page