XQuery Help

Discussion in 'XML' started by jhagemeier@gmail.com, Jan 2, 2008.

  1. Guest

    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:

    '&EMAIL=&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
     
    , Jan 2, 2008
    #1
    1. Advertising

  2. wrote:

    > 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:
    >
    > '&EMAIL=&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;'))

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Jan 2, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Kish

    xquery help

    Jeff Kish, Oct 14, 2004, in forum: XML
    Replies:
    7
    Views:
    528
    Jeff Kish
    Oct 18, 2004
  2. Tony Lavinio
    Replies:
    0
    Views:
    411
    Tony Lavinio
    Apr 28, 2005
  3. xquery help

    , Nov 7, 2005, in forum: XML
    Replies:
    0
    Views:
    455
  4. xquery help please

    , Nov 8, 2005, in forum: XML
    Replies:
    1
    Views:
    456
    Priscilla Walmsley
    Nov 8, 2005
  5. Replies:
    0
    Views:
    350
Loading...

Share This Page