小编Gin*_*s K的帖子

使用XSLT 1.0进行URL编码

我在编写XSL时遇到问题.我有以下代码的链接:

<a>
<xsl:attribute name="href">
  <xsl:value-of select="concat($myUrl,'&amp;projectNumber=',$projectNumber)"/>
</xsl:attribute>
<xsl:attribute name="title">
  <xsl:value-of select="title"/>
</xsl:attribute>
LINK
</a>
Run Code Online (Sandbox Code Playgroud)

所以我需要将变量传递projectNumber给结尾myUrl.这很好用,我得到...myUrl...&projectNumber=...projectNumber...HTML.

问题是,变量projectNumber有时会有一些必须在链接的href中转义的字符.我试过str:escape-uri()很多不同的方式使用XSL功能,但仍然没有成功......

例如,如果myUrl www.example.com/example.aspx?a=b和projectNumber是aaa?aaa 我得到的href www.example.com/example.aspx?a=b&projectNumber=aaa?aaa,但我需要得到www.example.com/example.aspx?a=b&projectNumber=aaa%C5%ABaaa.(%C5%AB是'ū'逃脱的方式)有什么建议吗?谢谢.

xslt escaping character href

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

character ×1

escaping ×1

href ×1

xslt ×1