开发者

XSLT with value of select in URL string

开发者 https://www.devze.com 2023-02-20 10:19 出处:网络
I want to combine some XSL with XML and put out the resulting HTML. My XSl contains this line which doesnt work:

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

精彩评论

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