Xml XSL错误:XSL:template元素不能包含XSL:template元素
执行xsl后,出现错误: 因为:xsl:template元素不能包含xsl:template 元素;系统ID: 文件:/C:/xslt/CombineToOutput.xsl; 第19行;列#:-1元素只能在 样式表;系统ID: 文件:/C:/xslt/CombineToOutput.xsl; 第19行;列#:-1(未能编译样式表。2个错误 检测到。)(未能编译样式表。检测到2个错误。) XSLTXml XSL错误:XSL:template元素不能包含XSL:template元素,xml,xslt,Xml,Xslt,执行xsl后,出现错误: 因为:xsl:template元素不能包含xsl:template 元素;系统ID: 文件:/C:/xslt/CombineToOutput.xsl; 第19行;列#:-1元素只能在 样式表;系统ID: 文件:/C:/xslt/CombineToOutput.xsl; 第19行;列#:-1(未能编译样式表。2个错误 检测到。)(未能编译样式表。检测到2个错误。) XSLT <?xml version="1.0" encoding="utf-8"?> <
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.openapplications.org/oagis/9">
<!-- STICKER INFO COMBINETOOUTPUT-->
<xsl:template match="/">
<xsl:apply-templates select="child::node()/*[name()!='DbResponse']"/>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*:PurchaseOrder">
<xsl:apply-templates select="*:PurchaseOrderLine/Item/CustomerItemID/ID"/>
<xsl:template match="*:PurchaseOrderLine/Item/CustomerItemID/ID">
<xsl:variable name="ArtNr" select="/*/ProcessPurchaseOrder/DataArea/PurchaseOrder/PurchaseOrderLine/Item/CustomerItemID/ID"/>
<xsl:variable name="WepNr" select="/*/DbResponse/ResultSet/Row[Cell[@name='ARTNR']=$ArtNr]/Cell[@name='WEPNR']"/>
<xsl:copy>
<xsl:if test="$WepNr!=''">
<LineNumber><xsl:value-of select="$WepNr"/></LineNumber>
</xsl:if>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:template>
</xsl:stylesheet>
错误信息很清楚
<xsl:template match="*:PurchaseOrder">
包含
<xsl:template match="*:PurchaseOrderLine/Item/CustomerItemID/ID">
这在XSLT中是不允许的。只需移动内部模板,使其不再包含在外部模板中。我很难理解为什么您无法理解此错误消息,正如答案所述,这是非常清楚的。