0
나는 다음과 같은 XSLT 질문이 있습니다XSLT 일치 문제
은 가정하자 내가 가진이 XML
<items>
<item>
<type>dog</type>
<color>brown</color>
</item>
<item>
<type>dog</type>
<color>brown</color>
</item>
<item>
<type/>
<color>none</color>
</item>
<item>
<type>dog</type>
<color>black</color>
</item>
</items>
나는 XSL 1.0에서 다음을 사용하는 경우가 :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="item[type='dog']">
<item>
<itemType><xsl:value-of select="type"/></itemType>
<itemColor><xsl:value-of select="color"/></itemColor>
</item>
</xsl:template>
</xsl:stylesheet>
그것은에만 표시됩니다를 빈 노드 앞에 먼저 일치합니다.
내가 간과할만한 것이 있습니까?
더 이상의 문맥이 없으면 대답 할 수 없습니다. 샘플에 따르면 서식 파일은 위치에 관계없이 "dog"유형의 모든 항목과 일치합니다. 당신이 언급하지 않은 다른 것이 있어야합니다. – Tomalak
Aja! [내장 템플릿 규칙] (http://www.w3.org/TR/xslt#built-in-rule) 때문에이 질문을 했습니까? 빈'type' 자식을 가진'item' 또한 내장 된 "any element"규칙에 의해 일치 될 것입니다 –
"내가 간과하고있는 것이 있습니까?" - 예. 불행히도 우리는 무엇을 모릅니다. 문제는 당신이 우리에게 보여주지 않은 코드에 있습니다. –