Pravljica wrote:
I didn't understood a bit of your answer :)
How do you sort into variable? Also - what is an extension function?
Can you give me a link or something?
Here is a thread that has both an XSLT 1.0 example as well as an XSLT
2.0 example.
<http://groups.google.com/group/microsoft.public.xsl/browse_frm/thread/4b125811eb0b4f89/7e8b9562a75eb0bc?lnk=st&q=perform-sort+group%3Amicrosoft.public.xsl+author%3Ahonnen& rnum=1&hl=en#7e8b9562a75eb0bc>
I need this to get smallest date from my xml, I thought to do it this
way. I sort on date, and the first node is smallest date, the last node
is biggest date. Maybe I can do this easier?
Depends on the date format. If you have e.g.
<date-list>
<date>20060101</date>
<date>20050101</date>
<date>20060527</date>
<date>20041231</date>
</date-list>
then the XPath expression
/date-list/date[not(. > ../date)]
gives you the minimum date (e.g. 20041231).
For your earlier example you might also want to try
<xsl:for-each select="A">
<xsl:sort select="B" />
<xsl:if test="position() = 1">
<xsl:value-of select="." />
</xsl:if>
</xsl:for-each>
--
Martin Honnen
http://JavaScript.FAQTs.com/