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

Re: Selecting a particular node of an XML generated fr

Subject: Re: Selecting a particular node of an XML generated from Excel
From: "leegold" <leegold@xxxxxxxxxxx>
Date: Wed, 09 Nov 2011 12:27:02 -0700
Re:  Selecting a particular node of an XML generated fr
Hi,

If you're familiar with scripting languages maybe an alternative is,

use SAX and rife through it, keep a counter, when you reach what you
want then "do something".

Lee G.


> > I have a requirement where I am not sure of the best possible solution. The XML is generated from Excel. The problem is with missing rows which makes it difficult to select a particular node. Better I explain using this sample XML: [Pls ignore any case mismatch or spell mistakes]

...snip...

     <Cell><Data>YES</Data></Cell>    <!-- THIS IS 117th row (Cell) i.e.
     position() = 117 -->
> >          <!--GAIN SO MANY ROWS HERE -->
> >          <Cell><Data>199</Data></Cell>
> >          <Cell><Data>200</Data></Cell>   <!--ASSUME THIS IS 200TH ROW -->
> >      </Row>
> >      <Row>
> >          <Cell><Data>u3</Data></Cell>
> >         <Cell><Data>20th century</Data></Cell>
> >          <Cell><Data>blah blah</Data></Cell>
> >          <Cell ss:Index="117"><Data>NO</Data></Cell>    <!-- THIS IS 117th row But position() != 117  -->
> >          <Cell ss:Index="199"><Data>119</Data></Cell>
> >      </Row>
> > </root>
> >
> >
> > The excel to xml convertion results in empty excel columns getting stripped out in the resulting<Cell>. And so, the number of<Cell>'s vary for each<Row>. Now, if I want to select a particular<Cell>, say 117th<Cell>, I need to check any @ss:Index exist and if so, count()  the number of the preceding-sibling's + the preceding @ss:Index value. So, for 117th Cell value,
> >
> >
> > (A) in Row 1, 2nd<Cell>  of @ss:Indiex is 117th
> > (B) in Row 2, position() = 117 is the required one
> > (C) in Row 3, @ss:Indiex matching 117
> > (D) if none matching found, ignore
> >
> >
> > In my requirement, I need to select the N-th<Cell>  value and check whether it is 'yes' or 'no' and then process. I am trying approach something like this (incomplete)
...snip...

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.