[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Return the max value of a set of nodes using FLWR

Subject: Re: Return the max value of a set of nodes using FLWR
From: Philip Vallone <philip.vallone@xxxxxxxxxxx>
Date: Fri, 25 May 2012 08:35:25 -0400
Re:  Return the max value of a set of nodes using FLWR
ahhh ha! Thank you.


On May 25, 2012, at 8:16 AM, G. Ken Holman wrote:

> At 2012-05-25 08:10 -0400, Philip Vallone wrote:
>> How can I return the max value of a set of nodes using FLWR? In this
example I want to return:
>> ...
>> <xsl:sequence select="for $x in changenumber return number(max($x))"/>
>
> You've gone too deep ... you want to stop one level "up" and get the maximum
of each of the sets.
>
> I hope this helps.
>
> . . . . . . Ken
>
> T:\ftemp>type philip.xml
> <data>
>        <set>
>                <changenumber>0</changenumber>
>                <changenumber>3</changenumber>
>                <changenumber>0</changenumber>
>        </set>
>        <set>
>                <changenumber>0</changenumber>
>                <changenumber>2</changenumber>
>                <changenumber>1</changenumber>
>        </set>
>        <set>
>                <changenumber>0</changenumber>
>        </set>
> </data>
>
> T:\ftemp>xslt2 philip.xml philip.xsl
> <?xml version="1.0" encoding="UTF-8"?>3 2 0
> T:\ftemp>type philip.xsl
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  version="2.0">
>  <xsl:template match="/">
>    <xsl:sequence select="for $s in /data/set return max($s/changenumber)"/>
>  </xsl:template>
> </xsl:stylesheet>
> T:\ftemp>
>
>
> --
> Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012
> Contact us for world-wide XML consulting and instructor-led training
> Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
> Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
> G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
> Google+ profile: https://plus.google.com/116832879756988317389/about
> Legal business disclaimers:    http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.