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

Xquery - reduce two docs into one

  • From: Lamon Lemon <lamon_lemon@y...>
  • To: xml-dev@l...
  • Date: Thu, 11 Jan 2007 08:22:52 -0800 (PST)

Xquery - reduce two docs into one
I am quite new to xquery and I have a FLWOR question

I have 2 different files with the same "filename" elements. I want to reduce these files into one where the same filename elements are closed together surrounded by one meta element. Furthermore the "Value" element that belong to each filename should also be inside the meta element. For better understanding here is the first file:

<FNumber>
<meta>
<Value2>2.9</Value2>
<FileName>file4</FileName>
<FileName>file5</FileName>
</meta>
<meta>
<Value2>2.8</Value2>
<FileName>file7</FileName>
<FileName>file8</FileName>
<FileName>file9</FileName>
<FileName>file14</FileName>
<FileName>file15</FileName>
<FileName>file16</FileName>
<FileName>file17</FileName>
<FileName>file18</FileName>
<FileName>file19</FileName>
</meta>
<meta>
<Value2>16.0</Value2>
<FileName>file13</FileName>
</meta>
</FNumber>


and here the second:

<FocalLength>
<meta>
<Value1>70.0mm</Value1>
<FileName>file11</FileName>
</meta>
<meta>
<Value1>7.90mm</Value1>
<FileName>file1</FileName>
<FileName>file7</FileName>
<FileName>file8</FileName>
<FileName>file9</FileName>
<FileName>file14</FileName>
<FileName>file15</FileName>
<FileName>file16</FileName>
<FileName>file17</FileName>
<FileName>file18</FileName>
<FileName>file19</FileName>
</meta>
<meta>
<Value1>6.13mm</Value1>
<FileName>file6</FileName>
</meta>
<meta>
<Value1>6.0mm</Value1>
<FileName>file3</FileName>
</meta>
</FocalLength>


There are still some meta elements missing. Now I want to put these files together to something like this


<FF>
<meta>
<Value2>2.8</Value2>
<Value1>7.90mm</Value1>
<FileName>file7</FileName>
<FileName>file8</FileName>
<FileName>file9</FileName>
<FileName>file14</FileName>
<FileName>file15</FileName>
<FileName>file16</FileName>
<FileName>file17</FileName>
<FileName>file18</FileName>
<FileName>file19</FileName>
</meta>
</FF>

So "file1" is missing, because it belongs only to Value1 but not to value2. I hope one can understand what I am trying to achieve. Hopefully someone knows how to do it.

Thanks

Sebastian


Access over 1 million songs - http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=36035/*http://music.yahoo.com/unlimited/


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.