次のような XML があるとします。
<section name="SampleSection">
<item name="ScoredItem1">
<attributes>
<scored data_type="boolean" value="true"/>
</attributes>
</item>
<item name="UnscoredItem1">
<attributes>
<scored data_type="boolean" value="false"/>
</attributes>
</item>
<item key="(3272fbb5:22)" name="ScoredItem2">
<attributes>
<scored data_type="boolean" value="true"/>
</attributes>
</item>
</section>
さて、XSLT を使用すると、次のscored
attribute
ようなアイテムを数えることができます。
<xsl:variable name="scoredItems" select="item/attributes/scored"/>
<xsl:value-of select="count($scoredItems)"/>
もちろん、これは3の値を与えます。
scored
が であるアイテムのみをカウントしたいとしますtrue
。XSLT を使用してそれを行うにはどうすればよいですか? (この例では、値 2 が返されます。