Subject: Re: [xsl] Return the max value of a set of nodes using FLWR From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 25 May 2012 08:16:05 -0400 |
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))"/>
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Return the max value of a set, Philip Vallone | Thread | Re: [xsl] Return the max value of a, Philip Vallone |
[xsl] Return the max value of a set, Philip Vallone | Date | Re: [xsl] Return the max value of a, Philip Vallone |
Month |