Reputation: 339
I want to add and remove a processing-instruction as same as
<?xml-stylesheet type="text/xsl" href="OtxViewer.xsl" ?>
into a xml file with xquery but i cannot. please help me for a solution?
Upvotes: 0
Views: 849
Reputation: 3517
To remove the processing instruction you can copy all top-level nodes apart from the processing instruction, for example:
document {
doc("file:/c:/Untitled1.xml")/node()[not(. instance of processing-instruction(xml-stylesheet))]
}
to add a processing instruction you can insert it in a new document and copy in the top-level nodes from the old document, for example:
document {
processing-instruction xml-stylesheet {
'type="text/xsl" href="OtxViewer.xsl"'
},
doc("file:/c:/Untitled1.xml")/node()
}
Upvotes: 4