【问题标题】:XslCompiledTransform cannot load stylesheet, expects token '}'XslCompiledTransform 无法加载样式表,需要标记“}”
【发布时间】:2014-11-04 07:32:18
【问题描述】:

我有一个包含以下行的 XML:

 <Field Text="%%=$summ,{0:0.000}%%%" />

XslCompiledTransform.Load 需要 '}' 而不是 ':'。

 Expected token '}', found ':' in %%=$summ,{0 -->:<-- 0.000}%%%

有什么办法可以避免吗?

【问题讨论】:

    标签: c# xml xslcompiledtransform


    【解决方案1】:

    大括号用于 XSLT 中的属性值模板。

    XSLT 处理器将其内容评估为 XPath 表达式,而 0:0.000 不是有效的 XPath。

    如果你的意思是字面大括号,它们必须被转义(当然只在属性值中):

    <Field Text="%%=$summ,{{0:0.000}}%%%" />
    

    【讨论】:

      猜你喜欢
      • 2016-12-08
      • 1970-01-01
      • 1970-01-01
      • 2023-02-01
      • 2011-11-12
      • 1970-01-01
      • 2014-10-15
      • 1970-01-01
      相关资源
      最近更新 更多