2013-10-29 2 views
1

누구나 XSLT가 여기서 무엇을하고 있는지 말할 수 있습니까? 더 긴 XSLT 문서의 일부입니다.이 XSLT 부분은 무엇을합니까?

<xsl:template match="node[child::attribute[@NAME='entity']]"> 
<xsl:choose> 
    <xsl:when test="child::attribute[@NAME='entity']/@VALUE='accessval'"> 
     <xsl:element name="access"> 
      <xsl:apply-templates /> 
     </xsl:element> 
    </xsl:when> 
    <xsl:when test="child::attribute[@NAME='entity']/@VALUE='aclval'"> 
     <xsl:element name="acl"> 
      <xsl:apply-templates /> 
     </xsl:element> 
    </xsl:when> 
    </xsl:choose> 
</template> 

고마워요!

답변

1

그것은 NAME="entity"attribute 요소 아이가 어떤 node 요소를 일치, 그 attribute 요소의 VALUE 속성에 따라 그것은 node이 중 access 또는 acl하고 아이를 계속 처리, 즉 주어진하기 위해 이름을 변경합니다 :

<node> 
    <attribute NAME="entity" VALUE="accessval"/> 
    <!-- other elements here --> 
</node> 

<access> 
    <!-- result of applying templates to "attribute" and "other elements here" --> 
</access> 

을 생산 것경우이 "aclval"인 경우 access이 아닌 acl이라는 요소가 생성됩니다.

가 이길 것 xsl:choose 내부 xsl:when 일치하는 node 다음 내부에 하나 이상의 <attribute NAME="entity" VALUE="something" />는, 즉이 "를 확인하기 때문에 결과 요소가 access하지 acl

<node> 
    <attribute NAME="entity" VALUE="aclval"/> 
    <attribute NAME="entity" VALUE="accessval"/> 
    <!-- other elements here --> 
</node> 

을 부여가 된 경우 aclval "앞에"accessval "이 있어야합니다.