How to escape a semicolon in xsl:param?

2019-07-19 03:05发布

I'm writing an XSL transform in Visual Studio. It is reporting that the semicolon in the following is an "unexpected token":

<xsl:param name="delimiters" select=";#" />

Does anyone know how to escape the semicolon? It hasn't shown up on any character lists I've found so far.

4条回答
不美不萌又怎样
2楼-- · 2019-07-19 03:12

wallenborn is right. The reason is that a select attribute in XSL always expects an XPath expression. If you want to put a string literal there, you need to quote it.

查看更多
混吃等死
3楼-- · 2019-07-19 03:13

Have you tried this?

<xsl:param name="delimiters" select="';#'"/>
查看更多
贼婆χ
4楼-- · 2019-07-19 03:13

Try the following entity (semi-colon is ASCII character 59)...

&#59;
查看更多
祖国的老花朵
5楼-- · 2019-07-19 03:14

You presumably want the param delimiters to have the string ;# as it's value, given that that isn't a valid XPath expression? If so, you need to quote the attribute value:

<xsl:param name="delimiters" select="';#'" />

Note that the value is now wrapped in single quotes; this causes the attribute value to be interpreted as an XPath expression which returns a string.

查看更多
登录 后发表回答