1
<xsl:template name="makeDiv">   
    <xsl:when test="descendant::*[Parent][Name]">
    </xsl:when>  
</xsl:template>

某处下线...

<xsl:if test="descendant::ParentCheck">
   <xsl:call-template name="makeDiv"/>
</xsl:if>

有人可以向我解释定义了什么 template-name=makeDiv 以及测试在做什么吗?它是否正在寻找属于 的后代的任何节点的属性 ' Parent' 和 ' ' ?NameParentCheck

还有,什么<xsl:when test="not(descendant::*[SomeAttribute])"> 意思?它是指其他不是的子元素SomeAttribute吗?

4

1 回答 1

3

descendant:*[Parent][Name]表示“任何具有子 'Parent' 元素和 'Name' 元素的后代。

i.e. <SomeElement>
         <Parent/>
         <Name/>
     <SomeElement>

descendant::ParentCheck表示“任何名为 ParentCheck 的后代”

i.e. <ParentCheck />
于 2012-09-06T16:09:56.187 回答