0
給定文件一個,它包含:XSLT - 深等異常行爲
<body>
<ul id="d76e10">
<li id="d76e11">Zoom In: Enlarges.</li>
<li id="d76e13">Zoom Out: Reduces.</li>
</ul>
</body>
文件B包含:
<body>
<ul id="d78e10">
<li id="d78e11"><uicontrol id="d78e12">Zoom In</uicontrol>: Enlarges.</li>
<li id="d78e15"><uicontrol id="d78e16">Zoom Out</uicontrol>: Reduces.</li>
</ul>
</body>
和包含最後文件C:
<body>
<ul>
<li>
<p>Zoom In: Enlarges a section of the chart to show more detail.</p></li>
<li>other stuff</li>
</ul>
</body>
我試圖在文件C和A或文件C和B之間找到相同的<li>
標籤。
所以基本上,我有一個做到以下幾點,根據previous question:
<xsl:template match="li">
<xsl:variable name="matched-doc"
select="$ref-docs[//li[deep-equal(normalize-space(.), normalize-space(current()))]]" />
<!-- ref-docs contains file A and B. -->
</xsl:template>
當我運行這段代碼,我得到文件和 B. 顯然是個正面襲擊,似乎normalize-space可能做了一些事情,因爲我沒有嘗試過,並且沒有按預期那樣擊中。
任何人都可以幫我理解normalize-space爲什麼會破壞子節點嗎?
另外,如何讓Deep-equal功能忽略ID
屬性?
感謝您的信息,我想我將不得不寫我自己的版本的深等同! – Flag