J
Jorn W Janneck
hello everyone.
i have the sort of question that makes me feel like i am missing the forest
for the trees, so apologies if i am missing the blatantly obvious here. i am
using saxon, and mostly xslt version 1.1 (the unofficial one).
i have a template parameter, say v, which contains a sequence of nodes of
the same kind, say A, which all have an attribute, say n. these attributes
may have different numeric values. i have identified the least of those like
this:
<xsl:variable name="minN" select="min($v/@n)"/>
what i'd like to do now is to compute the index (in v) of the *first* node
whose n attribute has value $minN. iow, i'd like to write something like
<xsl:variable name="pos" select="???"/>
where ??? would be an xpath-expression computing the desired position. so
e.g. if v contained the nodes
<A n="5"/><A n="3"/><A n="4"/><A n="5"/><A n="3"/>
then minN would be 3, and pos should be 2. i have tried a few things that
seemed to produce correct results if there was only one node with the
corresponding attribute value, but i was not successful at finding a
solution that works in cases like the one above.
any input is greatly appreciated. thanks for your time.
regards,
-- j
i have the sort of question that makes me feel like i am missing the forest
for the trees, so apologies if i am missing the blatantly obvious here. i am
using saxon, and mostly xslt version 1.1 (the unofficial one).
i have a template parameter, say v, which contains a sequence of nodes of
the same kind, say A, which all have an attribute, say n. these attributes
may have different numeric values. i have identified the least of those like
this:
<xsl:variable name="minN" select="min($v/@n)"/>
what i'd like to do now is to compute the index (in v) of the *first* node
whose n attribute has value $minN. iow, i'd like to write something like
<xsl:variable name="pos" select="???"/>
where ??? would be an xpath-expression computing the desired position. so
e.g. if v contained the nodes
<A n="5"/><A n="3"/><A n="4"/><A n="5"/><A n="3"/>
then minN would be 3, and pos should be 2. i have tried a few things that
seemed to produce correct results if there was only one node with the
corresponding attribute value, but i was not successful at finding a
solution that works in cases like the one above.
any input is greatly appreciated. thanks for your time.
regards,
-- j