Re: [xsl] Can not select outer node

Subject: Re: [xsl] Can not select outer node
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Fri, 25 Jan 2008 09:21:06 +0530
On Jan 25, 2008 8:55 AM, Sean Tiley <sean.tiley@xxxxxxxxx> wrote:
> There can be many <table/> elements in the document. I know the only
> one I am interested in
> is the <table/> with the value "Test Case ID" in the first column of
> the first row.

You can get reference to such 'table' element as follows

/testsuite/table[tr[1]/td[1] = 'Test Case ID']

>
> I am trying to get this table so I can process it by grabbing each row
> and extracting the desired info.
>
> I have tried //table/tr[starts-with(td,"Test Case ID")]
> Which returns the first <tr/> in the correct table but I need the entire table.

Here you are asking for the 'tr' node; and that's what you are
getting. So this expression is wrong for your requirement, as you
yourself wrote.

>
> I think using table[1] somehow should work, but clearly I am not getting this
> as when I try //table[1]/tr[starts-with(td,"Test Case ID")] nothing is returned.

This would also return the 'tr' node (because, that's what you are
asking for). As I suggested in my expression, you need to point to the
level of 'table' (with predicate to filter such a table).


-- 
Regards,
Mukul Gandhi

Current Thread