xsl-list
[Top] [All Lists]

[xsl] Can not select outer node

2008-01-24 20:25:38
Hi there,
I have the following xml structure

<testsuite>
    <table>
        <tr>
            <td>Dummy Table</td>
        </tr>
    </table>

    <table>
        <tr>
            <td>Test Case ID</td>
            <td>Description</td>
            <td>Expected Result</td>
            <td>Actual Result</td>
            <td>Date Executed</td>
            <td>PASS / Fail</td>
            <td>Regression Test Suite</td>
        </tr>
        <tr>
            <td>01</td>
            <td>This test case verifies successful login</td>
            <td>System successfully authenticates the user and
displays user home page if valid username and password are
provided</td>
            <td>As Expected</td>
            <td>2008/01/23</td>
            <td>PASS</td>
            <td/>
        </tr>
        <tr>
            <td>02</td>
            <td>This test case verifies field validation when the
username is omitted during login
                attempts</td>
            <td>System remains on login page with the message
"Username is required" displayed</td>
            <td>System remained on login page but message displayed
was "UserID is required"</td>
            <td>2008/01/23</td>
            <td>FAIL</td>
            <td/>
        </tr>
        <tr>
            <td>03</td>
            <td>This test case verifies field validation when the
password is omitted during login
                attempts</td>
            <td>System remains on login page with the message
"Password is required" displayed</td>
            <td>As Expected</td>
            <td>2008/01/23</td>
            <td>PASS</td>
            <td/>
        </tr>
    </table>
</testsuite>

What I am trying to do analyze a test resut file.
The test cases and results are in a <table/> element within an xml file.
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.

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.

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.

Any help or ideas would be great.

I would prefer not to be given the answer, but a push/shove in the
right direction would be most beneficial.

Thank you in advance

-- 
Sean Tiley
sean(_dot_)tiley(_at_)gmail(_dot_)com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>