user219725
user219725

Reputation:

using variable value in href XSL

I knw its pretty basic question but I have just started reading it...

I have a variable name

<variable name="NAME">
http://www.yahoo.com/<xsl:value-of select="$someothervariable"/>
</variable>

and i want to use it in like this

I have used these two approaches but it didn't work

<a href="{NAME}">HELLO</a>
<a href="<xsl:value-of select="$NAME"/>

Any idea how to achieve this...

Thanks,

Upvotes: 6

Views: 14369

Answers (2)

Xfox
Xfox

Reputation: 361

<a>
    <xsl:attribute name="href">
        <xsl:value-of select="//YOUR_VAR_NAME"/>
    </xsl:attribute>
    LINK_TEXT
</a>

Upvotes: 1

mopoke
mopoke

Reputation: 10685

You need to combine your two approaches:

<xsl:variable name="NAME">yourValue</xsl:variable>
<a href="{$NAME}" />

Upvotes: 14

Related Questions