我希望我能做的xsl如下,但不幸的父/位()是無效的。如何獲取父元素的位置 - XSL
XSL
<xsl:template match="li">
<bullet>
<xsl:apply-templates/>
</bullet>
<!-- if this is the last bullet AND there are no more "p" tags, output footer -->
<xsl:if test="count(ancestor::div/*) = parent/position()">
<footer/>
</xsl:if>
</xsl:template>
XML
<html>
<div>
<p>There is an x number of me</p>
<p>There is an x number of me</p>
<p>There is an x number of me</p>
<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
</ul>
</div>
</html>
任何人有任何想法如何找出從這個問題內我的模板匹配裏?
謝謝!
@joe:沒有任何相關的髒話,我再說一遍,這是不是在XSLT的精神。請用xml文檔顯示一個完整的(但最小的)例子,想要的結果以及應該如何從源xml文檔中獲得結果。然後很多人將能夠顯示出正確的解決方案,這可能不會比較職位。 – 2010-04-02 16:46:34