H
Herr Herrner
hi,
i'm trying to count something in xml via xsl and don't quite get it. i
have something like (don't mind it's not logical)
<doc>
<s>
<w type="a">how</w>
<w type="b">are</w>
<w type="a">you</w>
</s>
<s>
<w type="c">i</w>
<w type="a">am</w>
<w type="b">fine</w>
</s>
<s>
<w type="a">i</w>
<w type="a">am</w>
<w type="b">fine</w>
</s>
<s>
<w type="a">i</w>
<w type="a">am</w>
<w type="b">fine</w>
</s>
</doc>
i'm counting all <s>-elements with a <w type="a">-element as first
element by doing:
<xsl:value-of select="count(//s/w[position()=1 and contains(@type,'a')])"/>
(results in "3" for the above example; i need to use "contains" since it
can also look like type="a ff ee")
but i'm stuck finding a proper query for (all <s> elements having a <w
type="a"> element as first element and a <w type="b"> element as second)
(should result in "1" for the above example) and for (all <s> elements
having a <w type="a"> element as first element and a <w type="b">
element as greater-than-second) (would resoult in "2" in the above example)
Any help?
Thanks,
Herr Herrner
i'm trying to count something in xml via xsl and don't quite get it. i
have something like (don't mind it's not logical)
<doc>
<s>
<w type="a">how</w>
<w type="b">are</w>
<w type="a">you</w>
</s>
<s>
<w type="c">i</w>
<w type="a">am</w>
<w type="b">fine</w>
</s>
<s>
<w type="a">i</w>
<w type="a">am</w>
<w type="b">fine</w>
</s>
<s>
<w type="a">i</w>
<w type="a">am</w>
<w type="b">fine</w>
</s>
</doc>
i'm counting all <s>-elements with a <w type="a">-element as first
element by doing:
<xsl:value-of select="count(//s/w[position()=1 and contains(@type,'a')])"/>
(results in "3" for the above example; i need to use "contains" since it
can also look like type="a ff ee")
but i'm stuck finding a proper query for (all <s> elements having a <w
type="a"> element as first element and a <w type="b"> element as second)
(should result in "1" for the above example) and for (all <s> elements
having a <w type="a"> element as first element and a <w type="b">
element as greater-than-second) (would resoult in "2" in the above example)
Any help?
Thanks,
Herr Herrner