Re: a deficiency in xslt (xpath?)

Matthew,

This should already work, and does in the XPath implementations
I just tested.

Given an input document like:

<document>
    <part>
    <chapter id="A"/>
    <chapter id="B"/>
    <chapter id="C"/>
  </part>
  <part>
    <chapter id="W"/>
    <chapter id="X"/>
  </part>
  <part>
    <chapter id="Y" />
    <chapter id="Z" />
  </part>
</document>

test.xml> (document//chapter)[last()]

Returns:

<chapter id="Z"/>


______________________________________________________________
Steve Muench, Lead XML Evangelist & Consulting Product Manager
BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
Author "Building Oracle XML Applications", O'Reilly
http://www.oreilly.com/catalog/orxmlapp/

----- Original Message -----
From: "Matthew Bentley" <matthew.bentley@brookers.co.nz>
To: <xsl-editors@w3.org>
Sent: Sunday, June 24, 2001 21:07
Subject: a deficiency in xslt (xpath?)


| Hi,
| I would recommend that in a future version of XSLT, allowance be made for
| expressions like 'select="(document//chapter)[last()]"'
| i.e select the last chapter element descendant of document.
| At the moment all you can do is 'select="document//chapter[last()]"',
which
| selects the last chapter under any given parent under document i.e returns
| multiple results in the following situation:
| <document>
| <part>
| <chapter />
| <chapter />
| <chapter />
| </part>
| <part>
| <chapter />
| <chapter />
| </part>
| <part>
| <chapter />
| <chapter />
| </part>
| </document>
| This is very limiting in many situations-
| Cheers,
| M@
|

Received on Monday, 25 June 2001 09:14:34 UTC