Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XQuery Help

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 1/2/2008 7:07:00 PM

jhagemeier@g... wrote:

> My XML looks like this:
> 
> <EmailContentData>
> <EMAIL>jdoe@g...</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:
> 
> '&EMAIL=jdoe@g...&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:output "method=text";
concat('&amp;', string-join(for $el in doc('test2008010201.xml')/*/* 
return concat(local-name($el), '=', data($el)), '&amp;'))

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent