[xquery-talk] XML to TEXT OUTPUT with xQUERY
Michael Kay
mike at saxonica.com
Fri Dec 3 11:31:06 PST 2010
It's a little bit product-dependent how the output of a query is produced.
There are basically two approaches. One is to write a query whose output
is a single string (your query produces a sequence of strings). The
other is to serialize the result of the query using the text output
method - which, for example, would take a sequence of strings and output
them space-separated.
Either way, generating new line characters shouldn't be a problem. Just
write them in the query as numeric character references - & # x a ;
Michael Kay
Saxonica
On 03/12/2010 09:20, Julio de la Vega wrote:
>
> Hi *,
>
> I need to process and xml file with xQuery and generate a text file
> with the result of my xquery. In my tests I have several issues:
>
> -Do I have to do it with string function or is there other option?
>
> -I need to give an specific format to the output but I cannot control
> line feeds. Is it possible to insert line feed with any command?
>
> -Do we have to use xslt instead of xquery? Is there any option to do
> it with xquery?
>
> Little example ot the actual development:
>
> for $metadata in doc('Estadisticas')/MetaData
>
> return
>
> (
>
> string($metadata/Partition/Attr[@name=
> 'CurrentPackageInPartition']/@value),
>
> string($metadata/Partition/Attr[@name= 'TotalPagesinDocument']/@value),
>
> )
>
> Thanks in advance
>
> Regards
>
> **
>
> *Julio de la Vega Pozo*
> /Consultor Senior/
> j.vega at helpprintsolutions.com <mailto:j.vega at helpprintsolutions.com>
>
> Avda. General Perón, 32 7º G 28020 Madrid tel: +34 91 598 0533
> <http://www.plaxo.com/click_to_call?src=jj_signature&To=%2B34+91+598+0533&Email=h.kuperman@helpprintsolutions.com>fax:
> +34 91 598 0694
>
> www.helpprintsolutions.com <http://www.helpprintsolutions.com/>
>
> Este correo electrónico contiene información privada y confidencial.
> Si usted no es el destinatario del mensaje no está autorizado a
> leerlo, copiarlo o difundirlo. Si lo ha recibido por error, por favor
> contacte con el remitente y destruya su contenido.
> Privileged/confidential information may be contained in this e-mail.
> Any reading, copying o dissemination of this communication by persons
> or entities other than its intended recipient is prohibited. If you
> received this in error, please contact the sender and delete it.
>
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20101203/49b380cd/attachment-0001.htm
More information about the talk
mailing list