Martin,
I changed the code a bit, so I could get everything from Assignment and below
Code:
<xsl:template match="ns2:Assignment">
<xsl:variable name="ct" as="xs:dateTime" select="current-dateTime()"/>
<xsl:variable name="min" as="xs:dateTime" select="min(//ns2:DutyDetails/ns2:ItemDetails/@StartDateTime/xs:dateTime(.)[. gt $ct])"/>
<xsl:copy-of select=".[ns2:DutyDetails/ns2:ItemDetails/@StartDateTime[xs:dateTime(.) eq $min]]"/>
</xsl:template>
but it is now giving me more data than I wanted.
A few questions for you if you don't mind?
Did you add that new predicate because ItemDetails can now be unbounded?
Can you recommend a good online XPath tutorial?
Because of my recent schema changes I now seem to be further from the desired output than I was before.
I am really looking to get the following output:
Code:
<ns2:Assignment>
<ns2:DutyDetails ID="2">
<ns2:ItemDetails StartDateTime="2010-09-23T15:40:00+08:00">
<ns2:Child>
<ns2:One>1</ns2:One>
<ns2:Two>2</ns2:Two>
<ns2:Three>3</ns2:Three>
</ns2:Child>
</ns2:ItemDetails>
</ns2:DutyDetails>
</ns2:Assignment>
Should I change my approach? By that I mean should I change my template to match on ItemDetails instead, find the date closest to 'current datetime' and then use that to somehow filter out my output?
If you see a better way of tackling my problem then don't hold back - tell me where you think I'm going wrong
(shouldn't really be working on the weekend but it get's so addictive if you can't come up with the right solution ha ha)
Thx