简体   繁体   English

如何在xsl:param中转义分号?

[英]How to escape a semicolon in xsl:param?

I'm writing an XSL transform in Visual Studio. 我正在Visual Studio中编写一个XSL转换。 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. 它还没有出现在我迄今为止找到的任何角色列表中。

你试过这个吗?

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

You presumably want the param delimiters to have the string ;# as it's value, given that that isn't a valid XPath expression? 您可能希望param delimiters具有字符串 ;#作为它的值,因为它不是有效的XPath表达式? 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. 这会导致属性值被解释为返回字符串的XPath表达式。

尝试以下实体(分号是ASCII字符59)...

&#59;

wallenborn is right. 瓦伦伯恩是对的。 The reason is that a select attribute in XSL always expects an XPath expression. 原因是XSL中的select属性总是需要XPath表达式。 If you want to put a string literal there, you need to quote it. 如果你想在那里放一个字符串文字,你需要引用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM