0

警告が表示されます

あいまいなルールの一致

テンプレートcopyReferenceおよび恒等変換のプロセッサから。

<xsl:template name="processChildNodes">
    <xsl:param name="El"/>

    <xsl:for-each select="$El/node()">
        <xsl:choose>
            <xsl:when test="@sameas">
                <xsl:apply-templates mode="copyReference" select="id(substring-after(@sameas, '#'))"/>
            </xsl:when>         
            <xsl:otherwise>
                <xsl:copy-of select="." />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:for-each>
</xsl:template>


<xsl:template match="*" mode="copyReference" name="copyReference">
    <xsl:copy>
        <xsl:apply-templates select="@* except (@stem.dir, @stem.sameas)"/>
    </xsl:copy>
</xsl:template>



<xsl:template match="node() | @*" mode="#all">
        <xsl:copy>
            <xsl:apply-templates select="node() | @*"/>
        </xsl:copy>
    </xsl:template>

xml スニペットは次のとおりです。

<layer>         
        <note oct="3" pname="b" stem.dir="up" stem.sameas="#note_17544b" xml:id="note_17544"/>          
</layer>
<layer>
    <note oct="4" pname="d" xml:id="note_17592"/>
    <note sameas="#note_17544" xml:id="note_17544b"/>   
</layer>

私がやりたいことは、@stem.dir と @stem.sameas なしで @sameas-attribute から参照されるノードをコピーすることです。が適用される異なるノード local-names() が存在する可能性があります。したがって、 copyReferenceテンプレートの @match-attribute でノード名を指定したくありません。必要なノードを @select-attribute で渡し、さらに @mode を追加すると、必要なものだけに一致すると思いました。実際には機能しますが、警告が表示されるので、何かが間違っているはずです。

4

1 に答える 1