Hello,
I almost hate to bring this up here, as I know it's really more of an XPath/XSLT issue than something to do with OPS, but I have a stylesheet that I'm trying to select the greatest (most recent) dateTime from a collection of values. My statement looks somewhat like this: <xsl:value-of select="max(//@modified)"/> doing this gives me the error: Failure converting {2004-11-14T00:42:00-05:00} to a number I've also tried wrapping the selector in an explicit cast: <xsl:value-of select="max(xs:dateTime(//@modified))"/> but that just gives me the error: A sequence of more than one item is not allowed as the value in 'cast as' expression does anyone know of a good way to get this to read the values of //@modified as xs:dateTime? I'm don't have a schema attached, but I would if it would work. I don't have Saxon-SA, do I need it? Any help with this would be greatly appreciated. Daniel E. Renfer (http://kronkltd.net/) -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
On 3/28/06, Daniel E. Renfer <[hidden email]> wrote:
> I almost hate to bring this up here, as I know it's really more of an > XPath/XSLT issue than something to do with OPS, but I have a > stylesheet that I'm trying to select the greatest (most recent) > dateTime from a collection of values. No problem. We like XPath questions too :). > I've also tried wrapping the selector in an explicit cast: > <xsl:value-of select="max(xs:dateTime(//@modified))"/> //@modified will return a sequence, while you want to convert each element of the sequence to an xs:dateTime. So give this a try: max(for $d in //@modified return xs:dateTime($d)) Alex -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Thanks, that did the trick. I was thinking about that, but for some
reason I thought FLWOR was only available in XQuery. I was trying to figure out a way to do this same thing using just 'xpath'. (I'm still transitioning myself to XSLT 2.0) Daniel E. Renfer (http://kronkltd.net/) On 3/28/06, Alessandro Vernet <[hidden email]> wrote: > On 3/28/06, Daniel E. Renfer <[hidden email]> wrote: > > I almost hate to bring this up here, as I know it's really more of an > > XPath/XSLT issue than something to do with OPS, but I have a > > stylesheet that I'm trying to select the greatest (most recent) > > dateTime from a collection of values. > > No problem. We like XPath questions too :). > > > I've also tried wrapping the selector in an explicit cast: > > <xsl:value-of select="max(xs:dateTime(//@modified))"/> > > //@modified will return a sequence, while you want to convert each > element of the sequence to an xs:dateTime. So give this a try: > > max(for $d in //@modified return xs:dateTime($d)) > > Alex > -- > Blog (XML, Web apps, Open Source): > http://www.orbeon.com/blog/ > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |