IF the xml output looks like this:

let $xmlResults :=

<results>

   <item>

       <addr>24 Short Rd</addr>

       <city>Baltimore</city>

       <state>MD</state>

       <testVal>TEST1</testVal>

   </item>

   <item>

       <addr>55 Tall Rd</addr>

       <city>Orlando</city>

       <state>FL</state>

       <testVal/>

   </item>
   <item>

       <addr>88 Wide Rd</addr>

       <city>Boston</city>

       <state>MA</state>

       <testVal>TEST44</testVal>

   </item>


   <item>

       <addr>99 Narrow Rd</addr>

       <city></city>

       <state></state>

       <testVal/>

   </item>
</results> 

return

string-join(($xmlResults/item/addr, $xmlResults/item/city, 
$xmlResults/item/state,

                $xmlResults/item/testVal), ",")

 



 


 



 

> From: [email protected]
> To: [email protected]
> Date: Mon, 22 Feb 2010 14:02:54 +0100
> Subject: RE: [MarkLogic Dev General] Distinct Nodes/Value Functions
> 
> Hi Tony,
> 
> Can you give some sample code of what you tried, and a more detailed 
> description of what result you would like, given some sample input?
> 
> Kind regards,
> Geert
> 
> >
> 
> 
> drs. G.P.H. (Geert) Josten
> Consultant
> 
> 
> Daidalos BV
> Hoekeindsehof 1-4
> 2665 JZ Bleiswijk
> 
> T +31 (0)10 850 1200
> F +31 (0)10 850 1199
> 
> mailto:[email protected]
> http://www.daidalos.nl/
> 
> KvK 27164984
> 
> P Please consider the environment before printing this mail.
> De informatie - verzonden in of met dit e-mailbericht - is afkomstig van 
> Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
> bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
> bericht kunnen geen rechten worden ontleend.
> 
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of
> > Tony Mariella
> > Sent: maandag 22 februari 2010 13:29
> > To: [email protected]
> > Subject: RE: [MarkLogic Dev General] Distinct Nodes/Value Functions
> >
> > How would I convert the xml outout to a CSV output ?
> > I've tried several things, but seem to get a list of all the
> > elements not a row-to-row list of elements
> >
> >
> >
> >
> > > Date: Fri, 19 Feb 2010 14:03:21 -0500
> > > To: [email protected]
> > > From: [email protected]
> > > Subject: RE: [MarkLogic Dev General] Distinct Nodes/Value Functions
> > >
> > > At 2010-02-19 13:59 -0500, Tony Mariella wrote:
> > > >This seems to be working..
> > >
> > > I'm glad!
> > >
> > > >Not I also need to convert the results to a CSV format..
> > working on
> > > >string-join and other suggestions ?
> > >
> > > Nope ... just watch your quote usage and escaping. Use
> > string-join()
> > > with a sequence of your nodes being processed, calling an escaping
> > > function for each ... something like the following where $n
> > contains
> > > all of the nodes with the values to be put into the record:
> > >
> > > string-join( $n/local:escape-this(.), ',' )
> > >
> > > I hope this helps.
> > >
> > > . . . . . . . . . . . . Ken
> > >
> > >
> > > --
> > > XSLT/XQuery training: after http://XMLPrague.cz 2010-03-15/19
> > > XSLT/XQuery training: San Carlos, California 2010-04-26/30
> > Principles
> > > of XSLT for XQuery Writers: San Francisco,CA 2010-05-03
> > > XSLT/XQuery/UBL/Code List training: Trondheim,Norway 2010-06-02/11
> > > Vote for your XML training: http://www.CraneSoftwrights.com/q/i/
> > > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/
> > > G. Ken Holman mailto:[email protected]
> > > Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc
> > > Legal business disclaimers: http://www.CraneSoftwrights.com/legal
> > >
> > > _______________________________________________
> > > General mailing list
> > > [email protected]
> > > http://xqzone.com/mailman/listinfo/general
> >
> >
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
                                          
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to