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

Are nested brackets legal? Is this the same as positio

Subject: Are nested brackets legal? Is this the same as positional grouping?
From: Abel Online <abel.online@xxxxxxxxx>
Date: Wed, 16 Aug 2006 20:25:38 +0200
nested brackets
Hi List,

Not sure if I state this correctly, but here's what I am trying to achieve: Select all "row" nodes where the second cell contains "selected-id = $table-id". What I have is the following:

<xsl:apply-templates select="twz:rows/twz:row[twz:cell/@selected-id = $car-id]" />

But that is clearly not working when the fourth cell with 'selected-id' is having a value equal to $car-id (see XML snippet below: more cells may have a "selected-id", only the second cell is important here)

Now for something that surprised me. The following appeared to be working in TransformIIX (Gecko, client-side XSLT 1.0). Not sure it works with other xslt/xpath processors though. But I must say, it is mighty handy.

<xsl:apply-templates select="twz:rows/twz:row[twz:cell[2]/@selected-id = $car-id]" />

From what I found on the web and on this list, it appears that subsequent bracketing (//node[cell][2][item][3]) is allowed, but nested bracketing not. Can someone shine some light on this? It works for me, but it gives me a bit of a strange feeling ;-) . Some people had some posts recently on positional grouping. I had some trouble understanding what was going on, but isn't this basically the same?

The following is a legal variant, but does not actually do what I want:

<xsl:apply-templates select="twz:row[twz:cell][2][@selected-id = $table-id]" />


*** SAMPLE XML **** <data> <rows> <row id="1"> <cell>Filename 3</cell> <cell selected-id="1">Car A</cell> <cell>exported_filename.xml</cell> <cell selected-id="3">Company 1</cell> </row> <row id="2"> <cell>Filename 1</cell> <cell selected-id="1">Car A</cell> <cell>xyz.xml</cell> <cell selected-id="3">Company 1</cell> </row> <row id="3"> <cell>Filename 1</cell> <cell selected-id="2">Car OTHER</cell> <cell>other.xml</cell> <cell selected-id="2">Other company</cell> </row> </rows> </data>

Cheers,
Abel Braaksma
http://www.nuntia.nl

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.