0

I want to combine some XSL with XML and put out the resulting HTML.

My XSl contains this line which doesnt work:

<a href="www.domain.com/account/business/get/?t=2&amp;id=<xsl:value-of select="row/objectid"/>">Click here</a>

The desired output would be:

<a href="www.domain.com/account/business/get/?t=2&id=6">Click here</a>

The code works when I leave out the <xsl:value-of select="row/objectid"/> part in the URL. It also works when I place the <xsl:value-of select="row/objectid"/> outside the hyperlink tag, so i KNOW the value-of-select to be correct by itself.

So I suspect that the quotes are messing things up...how can I fix this?

PS. I tried replacing " with ' as well

1
  • pls show the surround XSL code. Commented Mar 29, 2011 at 20:22

1 Answer 1

2

Your stylesheet should contain well-formed XML, so you can't include the output from value-of in an attribute. Use an attribute value template instead:

<a href="www.domain.com/account/business/get/?t=2&amp;id={row/objectid}"
  >Click here</a>

The expression in curly braces will be evaluated and replaced with its output.

Sign up to request clarification or add additional context in comments.

1 Comment

I think double-quote before {row is misplaced.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.