Q about node-set comparisons, or casting, or maybe variables
Posted: Sun Apr 29, 2012 10:22 pm
It would help if I even knew what sort of question it was... could someone please gently explain to me what's happening here:
Result:
Is there something special about comparing element and attribute nodes? What sort of magical thing is the variable declaration doing here? (Saxon-EE 9.3.0.5 in Oxygen 13.2)
Thanks, --alex.
Code: Select all
<types good="A">
<type>A</type>
<type>B</type>
<type>A</type>
<type>C</type>
</types>
<xsl:template match="types">
<xsl:message select="concat('1: Good=', count(type[. = @good]))"/>
<xsl:variable name="g" select="@good"/>
<xsl:message select="concat('2: Good=', count(type[. = $g]))"/>
</xsl:template>
Result:
Code: Select all
[Saxon-EE]1: Good=0
[Saxon-EE]2: Good=2
Thanks, --alex.