XQuery Help

jhagemeier

Usenet Archive
Joined
Jan 2, 2008
Messages
2
Reaction score
0
Hello,

I'm looking for some help with an xquery.

My XML looks like this:

<EmailContentData>
<EMAIL></EMAIL>
<GPP_NBR>1111222233334444</GPP_NBR>
<!-- other elements here -->
</EmailContentData>

I need to create an xquery that will return ALL the nodes within the <EmailContentData> in concatenated string form, with a little bit of formating. Like this:

'&&GPP_NBR=1111222233334444'

The difficulty I'm having is figuring out how to generically concatenate data across multiple nodes without referencing the node names directly. I need the xq to be generic because the <EmailContentData> nodes may vary by document.

Any help would be sincerely appreciated.

Thanks,
Jeff
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
My XML looks like this:

<EmailContentData>
<EMAIL></EMAIL>
<GPP_NBR>1111222233334444</GPP_NBR>
<!-- other elements here -->
</EmailContentData>

I need to create an xquery that will return ALL the nodes within the <EmailContentData> in concatenated string form, with a little bit of formating. Like this:

'&&GPP_NBR=1111222233334444'

The difficulty I'm having is figuring out how to generically concatenate data across multiple nodes without referencing the node names directly. I need the xq to be generic because the <EmailContentData> nodes may vary by document.

Here is an example that works for me with Saxon:

declare namespace saxon="http://saxon.sf.net/"; declare option saxon:eek:utput "method=text"; concat('&amp;', string-join(for $el in doc('test2008010201.xml')/*/* return concat(local-name($el), '=', data($el)), '&amp;'))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,245
Members
248,133
Latest member
DujonT

Latest Threads

Top