开发者

XSLT with value of select in URL string

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>
开发者_JAVA百科

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜