dynamically refer to elements

Jim Neff
  • Jim Neff

    Jim Neff - 2004-11-23

    First off, I'm sorry if this is the wrong place to put this question. I'm new to XSLT and I am also an idiot, so I have two strikes against me already ...

    I need to dynamically refer to an element. For example:

    <xsl:value-of select="$other_context/{content}"/>

    Where content is the name of an element in the current context. I want to dynamically access an element in the variable $other_context, which i have passed into this template by using the element

    <xsl:with-param name="other_context" select="."/>

    from the calling apply-template element.

    I fully expected the {content} to work but when I run it through saxon I get

    Unexpected token "{" in path expression

    Can someone please direct me to how I am supposed to do this?

    Thank you,
    Jim Neff

    • Michael Kay

      Michael Kay - 2004-11-24

      XSLT coding questions are best asked on the xsl-list at mulberrytech.com.

      The coding idiom you are looking for is


      Michael Kay


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks