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

Function Copy error

Michael Kay mike at saxonica.com
Mon Feb 8 13:02:35 PST 2010


  Function Copy error
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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20100208/085d4c59/attachment.htm


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.