Hi Stewart,

I am not quite sure why, but I think this has to do with the way the PI is 
constructed, where it does not want any whitespace in it.

Here is a way around the issue by first constructing a string and then creating 
an XML node out of it:

let $xml-version := '<?xml version="1.0" encoding="UTF-8"?>'
let $stylesheet := "<?xml-stylesheet type='text/xsl' 
href='http://ldschurch.dataformat.com/local/PMDC_TEISchema_Normal.xsl'?>"
let $tei := '<teiCorpus>hello</teiCorpus>'
return
 (xdmp:unquote(fn:concat($xml-version,$stylesheet, $tei)))

If the node is already in the database, another way is to use 
xdmp:node-insert-*, as follows:

let $pi := <?xml-stylesheet type='text/xsl' 
href='http://ldschurch.dataformat.com/local/PMDC_TEISchema_Normal.xsl'?>
return
xdmp:node-insert-before(doc("Docs/test.xml")/my-root, $pi)

Not sure if that will help but it might get you past it.

-Danny

From: [email protected] 
[mailto:[email protected]] On Behalf Of Stewart Shelline
Sent: Wednesday, June 10, 2009 11:37 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Adding processing instructions to the document 
node

I need to be able to add processing instructions to documents I create and 
store in ML. I assumed the following would accomplish that:

    let $xml-version := <?xml version="1.0" encoding="UTF-8"?>
    let $stylesheet := <?xml-stylesheet type='text/xsl' 
href='http://ldschurch.dataformat.com/local/PMDC_TEISchema_Normal.xsl'?>
    let $tei := <teiCorpus ...>...</teiCorpus>
    return xdmp:document-insert( $uri, ($xml-version,$stylesheet,$tei) )

However, this throws the following error:

    XDMP-XMLPI: (err:XPST0003) <?xml  version="1.0" encoding="UTF-8"?> -- 
Processing instructions may not have the target 'XML'

Sorry for the newbie question, but what am I missing here?


NOTICE: This email message is for the sole use of the intended recipient(s) and 
may contain confidential and privileged information. Any unauthorized review, 
use, disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply email and destroy all copies of 
the original message.
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to