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

Simple question? element value last() - element value

Subject: Simple question? element value last() - element value (first)
From: j milo taylor <milo@xxxxxxxxxx>
Date: Mon, 04 Aug 2008 14:33:30 +0100
 Simple question? element value last() - element value
This is, I think, pretty simple, but I'm just not getting it.

I want to output a number value = x

where

x = last <Work_Year> - first <Work_Year>

///

I'm applying

<xsl:template match="artist_works">
<xsl:for-each select="works_details">
<xsl:value-of select="Work_Year[last()] - Work_Year[1]"/>
</xsl:for-each>
</xsl:template>


///

on the following XML

///

<artist_works>

<works_details>
<Work_ID>1</Work_ID>
<Work_Year>1945</Work_Year>
</works_details>

<works_details>
<Work_ID>2</Work_ID>
<Work_Year>1958</Work_Year>
</works_details>

<works_details>
<Work_ID>3</Work_ID>
<Work_Year>1972</Work_Year>
</works_details>

</artist_works>

All I'm getting is "000", where in this example it should be "27" i.e 1972-1945

Can anyone advise?

Best Regards
J Milo Taylor

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.