On 27 Oct 2004 09:06:13 -0700,
mi**@progress-partnership.co. uk (Mike Dickens)
wrote:
hi,
suppose i have:
<a>
<b i="Y" j="aaaa"/>
<c i="N" j="bbbb"/>
<d i="Y" j="cccc"/>
<e i="N" j="dddd"/>
<f i="N" j="eeee"/>
<g i="Y" j="ffff"/>
</a>
and i want to extract the elements where i="Y" such that i get something like
<x>
<y>1. aaaa</y>
<y>2. cccc</y>
<y>3. gggg</y>
</x>
how would i get the numbering to work across the different elements?
thanks,
mike
mmmm.. you just want to enumerate all of your elements?
What technology is at your disposal?
In XQuery, using books.xml,
this query:
for $t at $i in document("books .xml")//*[@year="1994"]
return <Response>{$i , name($t), string($t/@year)}</Response>
returns this data:
<Response>1 book 1994</Response>
Here is books.xml (from katz_c01.pdf tutorial I found via google at
http://www.datadirect.com/news/whats...book/index.ssp)
<bib>
<book year="1994">a19 94 <title>TCP/IP Illustrated</title>
<author>
<last>Stevens </last>
<first>W.</first>
</author>
<publisher>Addi son-Wesley</publisher>
<price>65.95</price>
</book>
<book year="1992">a19 92<title>Advanc ed Programming in the UNIX
Environment</title>
<author>
<last>Stevens </last>
<first>W.</first>
</author>
<publisher>Addi son-Wesley</publisher>
<price>65.95</price>
</book>
<book year="2000">a20 00<title>Data on the Web</title>
<author>
<last>Abiteboul </last>
<first>Serge</first>
</author>
<author>
<last>Buneman </last>
<first>Peter</first>
</author>
<author>
<last>Suciu</last>
<first>Dan</first>
</author>
<publisher>Morg an Kaufmann Publishers</publisher>
<price>65.95</price>
</book>
<book year="1999">a19 99<title>The Economics of Technology and Content
for Digital TV</title>
<editor>
<last>Gerbarg </last>
<first>Darcy</first>
<affiliation>CI TI</affiliation>
</editor>
<publisher>Kluw er Academic Publishers</publisher>
<price>129.95 </price>
</book>
</bib>
Jeff Kish