[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Function Copy error

Byomokesh Sahoo sahoo.byomokesh at gmail.com
Tue Feb 9 09:25:10 PST 2010


  Function Copy error
Ok David, But XMLSH Script environment for Unix. I am working in Windows



On Mon, Feb 8, 2010 at 8:09 PM, David Lee <http://x-query.com/mailman/listinfo/talk> wrote:
> This (multiple output files)  is a data direct specific feature.
>
> If you'd like to use saxon and XQuery but avoid writing custom java code,
> you might consider xmlsh.
> www.xmlsh.org
>
> The command "xsplit" will split documents of the sort you describe.
> http://www.xmlsh.org/CommandXsplit
>
> Combined with the the command  xmove
> http://www.xmlsh.org/CommandXmove
>
> Will rename the files in bulk based on an xpath expression.
>
>
> But the xslt example Mr. Kay suggested looks easier :)
>
> ( fyi you can run xslt as a post process to your xquery code in your
> language of choice, including xmlsh).
>  xquery ... | xslt ...
>
>
>
>
> ----------------------------------------------------
> David A. Lee
> http://x-query.com/mailman/listinfo/talk
> http://www.calldei.com
> http://www.xmlsh.org
>
>
> --------------------------------------------------
> From: "Byomokesh Sahoo" <http://x-query.com/mailman/listinfo/talk>
> Sent: Monday, February 08, 2010 9:00 AM
> To: <http://x-query.com/mailman/listinfo/talk>
> Subject: Re:  Function Copy error
>
>> Yes. Its very easy to do using XSLT. Just I want try to do any
>> possibility using XQuery.
>>
>> I saw that
>>
>> Generating Multiple XML documents Using XQuery
>>
>>
>> http://www.datadirect.com/developer/data-integration/tutorials/xml-output/index.ssp
>>
>>
>> Thanks
>> Byomokesh
>>
>>
>> On Mon, Feb 8, 2010 at 6:32 PM, Michael Kay <http://x-query.com/mailman/listinfo/talk> wrote:
>>>
>>> There is no function called copy(). What made you think there was, and
>>> what did you expect it do?
>>>
>>> XQuery doesn't really have a way to write multiple result documents. You
>>> could do it by returning a sequence of document nodes to the application,
>>> and then having the Java application serialize them and write them to disk,
>>> but it would have to know where to write them. It's easier to achieve this
>>> in XSLT:
>>>
>>> <xsl:template match="row">
>>>  <xsl:result-document href="{Term}.xml">
>>>     <xsl:copy-of select="."/>
>>>  </xsl:result-document>
>>> </xsl:template>
>>>
>>> Regards,
>>>
>>> Michael Kay
>>> http://www.saxonica.com/
>>> http://twitter.com/michaelhkay
>>>
>>> ________________________________
>>> From: http://x-query.com/mailman/listinfo/talk [mailto:http://x-query.com/mailman/listinfo/talk] On
>>> Behalf Of Byomokesh Sahoo
>>> Sent: 08 February 2010 12:14
>>> To: http://x-query.com/mailman/listinfo/talk
>>> Subject:  Function Copy error
>>>
>>> Hi,
>>>
>>> I want split the one xml to multiple xml file using xquery. But it
>>> showing error function copy. Please see the below code and give some point
>>> out.
>>>
>>> XML
>>>
>>> <root>
>>>    <row>
>>>        <Term>Hi</Term>
>>>        <Definition>An informal short greeting.</Definition>
>>>    </row>
>>>    <row>
>>>        <Term>Hello</Term>
>>>        <Definition>A more formal greeting.</Definition>
>>>    </row>
>>> </root>
>>>
>>>
>>>
>>> let $input-document := 'splitfile.xml'
>>> let $collection := 'file///D:/temp'
>>>
>>>     for $term-data in doc($input-document)/root/row
>>>                let $term-name := $term-data/Term/text()
>>>        let $documentname := concat($term-name, '.xml')
>>>        let $store-return := copy($collection, $documentname, $term-data)
>>>
>>>     return
>>>        <store-result>
>>>           <store>{$term-name}</store>
>>>           <documentname>{$documentname}</documentname>
>>>        </store-result>
>>>
>>> I am using saxon 9.2
>>>
>>> Thanks
>>> Byomokesh
>>
>> _______________________________________________
>> http://x-query.com/mailman/listinfo/talk
>> http://x-query.com/mailman/listinfo/talk
>>
>



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.