xml - XTDE0160 : XSLT 1. 0 兼容模式在此配置中不可用/发票的内置模板规则:未命名模式下的请求

标签 xml xslt

我总是遇到同样的问题。我已经创建了一个问题:命名空间前缀 xsl on value-of is not defined。感谢迈克尔的回答。我看到了所有类似的问题,但没有找到任何帮助。我使用 saxon9he 测试我的代码,并尝试使用 muenchian 方法对其进行分组。 XML 文件:

<invoice:request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:invoice="http://www.xmlData.ch/xmlInvoice/XSD" 
    xsi:schemaLocation="http://www.forum-datenaustausch.ch/invoice MDInvoiceRequest_400.xsd" role="production">

    <invoice:invoice invoice_id="22">
      <invoice:vat>0.00</invoice:vat>
      <invoice:record_tarmed>Rapport médical sur formulaire assurance-maladie</invoice:record_tarmed>
  </invoice:invoice>
    <invoice:invoice invoice_id="23">
      <invoice:vat>5.00</invoice:vat>
      <invoice:record_tarmed>Salle d'examen et de traitement, chirurgie et chirurgie pédiatrique</invoice:record_tarmed>
   </invoice:invoice> 
</invoice:request>

XSLT 文件:

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:invoice="http://www.xmlData.ch/xmlInvoice/XSD"
  exclude-result-prefixes="invoice">

  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

  <xsl:key name="factures-par-TVA" match="invoice:invoice" use="invoice:vat"/>
  <xsl:template match="invoice:request">
    <Documents>
       <xsl:for-each select="invoice:invoice[count(. | key('factures-par-TVA', invoice:vat)[1]) = 1]">
          <xsl:sort select="invoice:vat" />
          <Document>
            <xsl:copy-of select="invoice:vat" />
            <xsl:for-each select="key('factures-par-TVA',invoice:vat)">
               <xsl:sort select="invoice:invoice/@invoice_id"/>
               <xsl:copy-of select="invoice:record_tarmed"/>
            </xsl:for-each>
          </Document>
        </xsl:for-each>
      </Documents>
    </xsl:template>
  </xsl:stylesheet>

结果是一样的:错误 XTDE0160。如果我删除“请求”的“发票:”,temp.html 文件包含 4 个节点的文本,我收到此警告 SXXP0005:源文档位于命名空间 http://www.xmlData.ch/xmlInvoice/XSD 中, 但所有模板规则都匹配没有命名空间中的元素。

我尝试了 xsl:template 的模式属性,但它不起作用。

我能做什么?

谢谢你的帮助

最佳答案

正如 Martin 在他的评论中指出的(这本来应该是一个答案),该消息意味着 Saxon9-HE 不再提供 XPath 1.0 兼容模式,因此它不会运行标有 version="1.0"的样式表。最后一个提供此功能的开源 Saxon 版本是 Saxon 9.7,当然现在仍然可用。

您可能出于某些原因不想继续使用 XSLT 2.0 或 3.0:xsl:for-each-group 指令使此类代码变得如此简单。

更新(2018 年 1 月 30 日):为响应大众需求,我们已恢复此更改。 Saxon-HE 从 9.8.0.7 开始的后续维护版本恢复了在向后兼容模式下运行 XSLT 1.0 样式表的能力。

关于xml - XTDE0160 : XSLT 1. 0 兼容模式在此配置中不可用/发票的内置模板规则:未命名模式下的请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45595852/

相关文章:

java - 带有 xpath 的配置 <set-variable> 在从 xml 有效负载中提取时给出空字符串

python - 使用 xml.etree.ElementTree (python) 解析 XML 时,如何区分常规空格和转义空格 ()

xslt - 计算 XSLT 中的不同项目

xslt - 使用stringparam的xsltproc命令行参数

javax.el.PropertyNotFoundException : Property 'genero' not found on type model.

xml - 为特定属性选择具有最高值的所有节点

xml - 使用 xslt 遍历属性

java - 如何让 XSLT 在输出数值运算结果时停止使用科学记数法?

sql-server - 从数据库中检索数据时如何转义特殊字符?

python - 根据子元素的属性使用 XSLT 或 Python 对 XML 文件进行排序