【发布时间】:2013-07-10 11:52:32
【问题描述】:
我在编写 XSL 时遇到问题。我有以下代码的链接:
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($myUrl,'&projectNumber=',$projectNumber)"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="title"/>
</xsl:attribute>
LINK
</a>
所以我需要将变量projectNumber 传递到myUrl 的末尾。这工作得很好,我在 HTML 中得到了...myUrl...&projectNumber=...projectNumber...。
问题是,变量projectNumber 有时有一些字符必须在我的链接的href 中转义。我尝试以多种不同的方式使用 XSL 函数str:escape-uri(),但仍然没有成功...
例如,如果 myUrl 是 www.example.com/example.aspx?a=b 而 projectNumber 是 aaaūaaa
我得到像www.example.com/example.aspx?a=b&projectNumber=aaaūaaa 这样的href,但我需要得到www.example.com/example.aspx?a=b&projectNumber=aaa%C5%ABaaa。 (%C5%AB 是 'ū' 的转义方式)有什么建议吗?谢谢。
【问题讨论】:
标签: xslt escaping character href