Hi Paul,
You are not being specific about *exactly* what you are doing, so it is hard to
tell for sure what is going on. My guess, though, is that the namespace being
used is picked up from your XQuery context. The following example I think does
what you are trying to do:
(: create a document :)
xquery version "1.0-ml";
xdmp:document-insert("/test.xml",
<html xmlns="http://www.w3.org/1999/xhtml">
<body><p>some stuff here</p></body>
</html>) ;
(: insert a node after the first xhtml p tag :)
xquery version "1.0-ml";
declare namespace xh="http://www.w3.org/1999/xhtml";
declare namespace foo="foo";
xdmp:node-insert-after(doc("/test.xml")/xh:html/xh:body/xh:p[1],
<p xmlns="foo">foo</p>) ;
(: look at that document :)
fn:doc("/test.xml")
(: returns:
<html xmlns="http://www.w3.org/1999/xhtml">
<body><p>some stuff here</p><p xmlns="foo">foo</p></body>
</html>
:)
Notice that the second p tag is in the "foo" namespace. Is that what you are
trying to do?
-Danny
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul M
Sent: Thursday, October 30, 2008 8:36 AM
To: [email protected]
Subject: [MarkLogic Dev General] embedded html
Hi:
I have the following html:
this is my <sub>html</sub> snippet
I want to add it to my tag:
<mytag xmlns="mine">
this is my <sub>123</sub> snippet
</mytag>
And then add it to my doc using node-insert
However, sub html element is now in the wrong namespace. So when I perform the
following:
*:mytag/node()
<sub xmlns="mine"> is in the wrong namespace
My best solution is creating an additional tag (note ->block<- level tag)
<mytag xmlns="mine">
<div xmlns="htmlns">
this is my <sub>123</sub> snippet
</div>
</mytag>
and when I want the html, I simply use
*:mytag/*:div/node()
I could also perform a search and replace on every html element before adding
the snippet (In perl most likely, so regexp)?
this is my <sub xmlns="htmlns">123</sub> snippet
The only other solution I can see is storing the html not as node by as data
(embedded). This seems somewhat prone to problems though.
How should this be handled. Best practices?
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general