Altova Mailing List Archives>Archive Index >xsl-list Archive Home >Recent entries >Thread Prev - Re: [xsl] Keys (easy one) match on name() >Thread Next - Re: [xsl] First Element in Sorted List [xsl] First Element in Sorted ListTo: Date: 6/1/2005 1:39:00 PM I am hoping to to confirm something before going in the wrong direction.
My process needs to take action on the first element in a list of
elements where the logic to determine first is the lowest numeric value
of the sortorder attribute. I don't believe there is a one-line way to
do this - I believe the entire list must be sorted, and then the
position of each element after sort compared to determine if it is first.
Is there a shorter/less expensive way to code the following
<xsl:for-each select="item">
<xsl:sort select="@sortorder" data-type="number" />
<xsl:if test="position() = 1">
<!-- this is the first element in the sorted list -->
</xsl:if>
</xsl:for-each>
I searched and found examples using this technique, but nothing really
saying that this was the best or only approach.
Thanks in advance,
-John | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
