L
Larry R
I am trying to use XPath (XSLT 1.0), EXSLT 1.1 (.Net) to select the
nodelist consisting of the 'top n' nodes. THe counter
is the count of item/value[ fieldName].
Using a traditional for-each logic, the psuedo code would look
something like this
counter=0
maxItems=4
nodelist = nothing
for each root/item
counter = counter + count(value/fieldName)
if counter < maxItems
nodelist.add (current() ) //adds this node to the nodelist
else
exit for
end if
next item
What I would expect of the above code is to return a nodeset consisting
of <item>s id 1 & 2. item id=3 was not included because it's children
made the counter exceed maxItems. Note, the item id value is only used
for reference.
Any help would be greatly appreciated by "One Less Bald Guy"
Thanks-
Larry
=================================================
<root>
<item id="1">
<value name="fieldName" instance="1">Alpha</value>
<value name="fieldName" instance="2">Beta</value>
</item>
<item id="2">
<value name="fieldName" instance="1">Charlie</value>
</item>
<item id="3">
<value name="fieldName" instance="1">Delta</value>
<value name="fieldName" instance="2">Echo</value>
</item>
</root>
nodelist consisting of the 'top n' nodes. THe counter
is the count of item/value[ fieldName].
Using a traditional for-each logic, the psuedo code would look
something like this
counter=0
maxItems=4
nodelist = nothing
for each root/item
counter = counter + count(value/fieldName)
if counter < maxItems
nodelist.add (current() ) //adds this node to the nodelist
else
exit for
end if
next item
What I would expect of the above code is to return a nodeset consisting
of <item>s id 1 & 2. item id=3 was not included because it's children
made the counter exceed maxItems. Note, the item id value is only used
for reference.
Any help would be greatly appreciated by "One Less Bald Guy"
Thanks-
Larry
=================================================
<root>
<item id="1">
<value name="fieldName" instance="1">Alpha</value>
<value name="fieldName" instance="2">Beta</value>
</item>
<item id="2">
<value name="fieldName" instance="1">Charlie</value>
</item>
<item id="3">
<value name="fieldName" instance="1">Delta</value>
<value name="fieldName" instance="2">Echo</value>
</item>
</root>