Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bo Kingo Damgaard 157 posts 456 karma points
    Nov 17, 2010 @ 14:29
    Bo Kingo Damgaard
    0

    How to use variable as part of select statement

    Hi

    I have a nodeset ($content) from where I want to select an element by using a variable ($element).

    I can get this line to work if I hardcode it

    <xsl:value-of select="$content/Brochure"/>

    If I use the variable like this

    <xsl:variable name="element" select="Brochure"/>
    <xsl:value-of select="$content/$element"/>

    it fails to save with the message "Unexpted token '$' in expression

    Can this be done somehow?

    Regards Bo

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Nov 17, 2010 @ 14:33
    Tom Fulton
    1

    I think you can use something like:

    $content/* [name() = $element]

  • Bo Kingo Damgaard 157 posts 456 karma points
    Nov 17, 2010 @ 14:46
    Bo Kingo Damgaard
    0

    Thanks Tom

    You saved my day

    /Bo

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies