我收到一个模糊的规则匹配错误,正在抛出我。这是一个错误:
Recoverable error
XTRE0540: Ambiguous rule match for
/dmodule/content[1]/description[1]/levelledPara[2]/levelledPara[4]/table[1]
Matches both "table[parent::levelledPara] | table[parent::proceduralStep]" on line 3047 of
file:/c:/users/c79460/AppData/Local/PWC%20PDF%20Generator/test3.xsl
and "table[not(parent::levelledPara)] | table[not(parent::proceduralStep)]" on line 2962
of file:/c:/users/c79460/AppData/Local/PWC%20PDF%20Generator/test3.xsl我看不出根据所引用的两条规则和它所匹配的道路,哪里会有任何含糊不清的地方。在我看来,这个表有一个levelledPara父表,所以为什么我会得到不匹配规则的歧义(父表::平面parent )?我相信我可能错过了一些可笑的简单的东西,希望一些新的视角会抓住它。这仅仅是因为我在match语句中使用了两个不同的父标记(levelledPara和proceduralStep)。
XSL:
<xsl:template match="table[not(parent::levelledPara)] | table[not(parent::proceduralStep)]">
<xsl:variable name="TId" select="@id"/>
<xsl:variable name="tCount">
<xsl:number level="any" count="table" format="1"/>
</xsl:variable>
<fo:table table-layout="fixed" width="100%" id="{$TId}" ><!--margin-left="-10mm" -->
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<xsl:if test="title/text()">
<!--border="1 solid black" --><fo:block keep-with-next="always" text-align="center" padding-top="8pt" padding-bottom="2pt" space-after="2pt" margin-left="-10mm">
<fo:inline font-style="italic">Table <xsl:value-of select="$tCount"/>
<xsl:value-of select="concat(' - ', ./title)"/></fo:inline>
<fo:retrieve-table-marker retrieve-class-name="tab-cont"
retrieve-position-within-table="first-starting"
retrieve-boundary-within-table="table"/>
</fo:block>
</xsl:if>
<xsl:if test="not(title/text())">
<fo:block keep-with-next="always" text-align="center" space-after="2pt">
<fo:inline font-style="italic">Table <xsl:value-of select="$tCount"/>
</fo:inline>
<fo:retrieve-table-marker retrieve-class-name="tab-cont"
retrieve-position-within-table="first-starting"
retrieve-boundary-within-table="table"/>
</fo:block>
</xsl:if>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="tab-cont"/>
<fo:block/>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="tab-cont"> - (Continued)</fo:marker>
<fo:block keep-with-previous="always">
<fo:marker marker-class-name="tab-cont"> - (Continued)</fo:marker>
<fo:table table-layout="fixed" width="100%">
<xsl:for-each select="colspec">
<fo:table-column column-width="proportional-column-width(@colwidth)"/>
</xsl:for-each>
<fo:table-header>
<xsl:for-each select="./tgroup/thead/row">
<fo:table-row>
<xsl:apply-templates/>
</fo:table-row>
</xsl:for-each>
</fo:table-header>
<fo:table-footer>
<fo:table-row>
<xsl:for-each select="./tgroup/thead/row[1]/entry"><!--[position() > 1]-->
<fo:table-cell border-top-style="solid" border-top-color="black" border-collapse="collapse">
<fo:block/>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</fo:table-footer>
<fo:table-body>
<xsl:for-each select="./tgroup/tbody/row">
<fo:table-row>
<xsl:apply-templates/>
</fo:table-row>
</xsl:for-each>
<xsl:if test="./tgroup/tfoot">
<xsl:for-each select="./tgroup/tfoot/row">
<fo:table-row>
<xsl:apply-templates/>
</fo:table-row>
</xsl:for-each>
</xsl:if>
</fo:table-body>
</fo:table>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
<xsl:template match="table[parent::levelledPara] | table[parent::proceduralStep]">
<xsl:variable name="TId" select="@id"/>
<xsl:variable name="tCount">
<xsl:number level="any" count="table" format="1"/>
</xsl:variable>
<fo:table table-layout="fixed" width="93%" id="{$TId}" margin-left="-10mm"><!--margin-left="-10mm" -->
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-header>
<fo:table-row>
<fo:table-cell>
<xsl:if test="title/text()">
<!--border="1 solid black" --><fo:block keep-with-next="always" text-align="center" padding-top="8pt" padding-bottom="2pt" space-after="2pt" margin-left="-10mm">
<fo:inline font-style="italic">Table <xsl:value-of select="$tCount"/>
<xsl:value-of select="concat(' - ', ./title)"/></fo:inline>
<fo:retrieve-table-marker retrieve-class-name="tab-cont"
retrieve-position-within-table="first-starting"
retrieve-boundary-within-table="table"/>
</fo:block>
</xsl:if>
<xsl:if test="not(title/text())">
<fo:block keep-with-next="always" text-align="center" space-after="2pt">
<fo:inline font-style="italic">Table <xsl:value-of select="$tCount"/>
</fo:inline>
<fo:retrieve-table-marker retrieve-class-name="tab-cont"
retrieve-position-within-table="first-starting"
retrieve-boundary-within-table="table"/>
</fo:block>
</xsl:if>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="tab-cont"/>
<fo:block/>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:marker marker-class-name="tab-cont"> - (Continued)</fo:marker>
<fo:block keep-with-previous="always">
<fo:marker marker-class-name="tab-cont"> - (Continued)</fo:marker>
<fo:table table-layout="fixed" width="100%">
<xsl:for-each select="colspec">
<fo:table-column column-width="proportional-column-width(@colwidth)"/>
</xsl:for-each>
<fo:table-header>
<xsl:for-each select="./tgroup/thead/row">
<fo:table-row>
<xsl:apply-templates/>
</fo:table-row>
</xsl:for-each>
</fo:table-header>
<fo:table-footer>
<fo:table-row>
<xsl:for-each select="./tgroup/thead/row[1]/entry"><!--[position() > 1]-->
<fo:table-cell border-top-style="solid" border-top-color="black" border-collapse="collapse">
<fo:block/>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</fo:table-footer>
<fo:table-body>
<xsl:for-each select="./tgroup/tbody/row">
<fo:table-row>
<xsl:apply-templates/>
</fo:table-row>
</xsl:for-each>
<xsl:if test="./tgroup/tfoot">
<xsl:for-each select="./tgroup/tfoot/row">
<fo:table-row>
<xsl:apply-templates/>
</fo:table-row>
</xsl:for-each>
</xsl:if>
</fo:table-body>
</fo:table>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>发布于 2015-12-07 13:18:02
这是因为levelledPara/table与table[parent::levelledPara]和table[not(parent::proceduralStep)]都匹配。你可能打算写:
<xsl:template match="table[not(parent::levelledPara or parent::proceduralStep)]">而不是:
<xsl:template match="table[not(parent::levelledPara)] | table[not(parent::proceduralStep)]">这仅仅是因为我在match语句中使用了两个不同的父标记(levelledPara和proceduralStep)。
但你没有or。您有union接线员。你是在联合桌子而不是他们的父母。这也会奏效的:
<xsl:template match="table[not(parent::levelledPara | parent::proceduralStep)]">https://stackoverflow.com/questions/34134165
复制相似问题