6

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,

2 Answers 2

14

You need to combine your two approaches:

<xsl:variable name="NAME">yourValue</xsl:variable> <a href="{$NAME}" /> 
Sign up to request clarification or add additional context in comments.

4 Comments

Can you provide some more context on your XSL? It could be a variable scoping issue. Or are there conditionals where your variable is first set?
Its working fine but there is empty spaces before and after the value in a tag.
That'll be the newlines you have surrounding your expression in the <variable></variable> tag. Try removing those newlines to get rid of leading/trailing spaces.
How do you use the same variable URL for multiple anchor tags? If I do another <a href="{$NAME}" /> tag, on the web page it simply tries to link to "NAME".
1
<a> <xsl:attribute name="href"> <xsl:value-of select="//YOUR_VAR_NAME"/> </xsl:attribute> LINK_TEXT </a> 

Comments