diff options
Diffstat (limited to 'test/namespaces')
-rw-r--r-- | test/namespaces/err_0.xml | 1 | ||||
-rw-r--r-- | test/namespaces/err_1.xml | 1 | ||||
-rw-r--r-- | test/namespaces/err_10.xml | 1 | ||||
-rw-r--r-- | test/namespaces/err_11.xml | 1 | ||||
-rw-r--r-- | test/namespaces/err_2.xml | 1 | ||||
-rw-r--r-- | test/namespaces/err_3.xml | 1 | ||||
-rw-r--r-- | test/namespaces/err_4.xml | 1 | ||||
-rw-r--r-- | test/namespaces/err_5.xml | 1 | ||||
-rw-r--r-- | test/namespaces/err_6.xml | 1 | ||||
-rw-r--r-- | test/namespaces/err_7.xml | 1 | ||||
-rw-r--r-- | test/namespaces/err_8.xml | 1 | ||||
-rw-r--r-- | test/namespaces/err_9.xml | 2 | ||||
-rw-r--r-- | test/namespaces/reconcile/tests-to-c.xsl | 275 | ||||
-rw-r--r-- | test/namespaces/reconcile/tests.xml | 249 |
14 files changed, 537 insertions, 0 deletions
diff --git a/test/namespaces/err_0.xml b/test/namespaces/err_0.xml new file mode 100644 index 0000000..50bdd32 --- /dev/null +++ b/test/namespaces/err_0.xml @@ -0,0 +1 @@ +<foo xmlnsbar="1"/> diff --git a/test/namespaces/err_1.xml b/test/namespaces/err_1.xml new file mode 100644 index 0000000..eb6f43b --- /dev/null +++ b/test/namespaces/err_1.xml @@ -0,0 +1 @@ +<foo xmlns:="http://example.com/"/> diff --git a/test/namespaces/err_10.xml b/test/namespaces/err_10.xml new file mode 100644 index 0000000..cf36261 --- /dev/null +++ b/test/namespaces/err_10.xml @@ -0,0 +1 @@ +<tst xmlns="http://example.com/" xmlns="http://example.com/"/> diff --git a/test/namespaces/err_11.xml b/test/namespaces/err_11.xml new file mode 100644 index 0000000..9d81939 --- /dev/null +++ b/test/namespaces/err_11.xml @@ -0,0 +1 @@ +<tst xmlns:a="http://example.com/" xmlns:a="http://example.com/"/> diff --git a/test/namespaces/err_2.xml b/test/namespaces/err_2.xml new file mode 100644 index 0000000..9fd51b3 --- /dev/null +++ b/test/namespaces/err_2.xml @@ -0,0 +1 @@ +<:/> diff --git a/test/namespaces/err_3.xml b/test/namespaces/err_3.xml new file mode 100644 index 0000000..3d4d439 --- /dev/null +++ b/test/namespaces/err_3.xml @@ -0,0 +1 @@ +<:foo/> diff --git a/test/namespaces/err_4.xml b/test/namespaces/err_4.xml new file mode 100644 index 0000000..9dc294e --- /dev/null +++ b/test/namespaces/err_4.xml @@ -0,0 +1 @@ +<f: xmlns:f="http://example.com/foo"/> diff --git a/test/namespaces/err_5.xml b/test/namespaces/err_5.xml new file mode 100644 index 0000000..5943c11 --- /dev/null +++ b/test/namespaces/err_5.xml @@ -0,0 +1 @@ +<f:a: xmlns:f="http://example.com/foo"/> diff --git a/test/namespaces/err_6.xml b/test/namespaces/err_6.xml new file mode 100644 index 0000000..e3eb3b2 --- /dev/null +++ b/test/namespaces/err_6.xml @@ -0,0 +1 @@ +<f:a:b xmlns:f="http://example.com/foo"/> diff --git a/test/namespaces/err_7.xml b/test/namespaces/err_7.xml new file mode 100644 index 0000000..5bbe235 --- /dev/null +++ b/test/namespaces/err_7.xml @@ -0,0 +1 @@ +<f:foo/> diff --git a/test/namespaces/err_8.xml b/test/namespaces/err_8.xml new file mode 100644 index 0000000..8321da2 --- /dev/null +++ b/test/namespaces/err_8.xml @@ -0,0 +1 @@ +<tst xmlns:xml="http://example.com/"/> diff --git a/test/namespaces/err_9.xml b/test/namespaces/err_9.xml new file mode 100644 index 0000000..4478c60 --- /dev/null +++ b/test/namespaces/err_9.xml @@ -0,0 +1,2 @@ +<tst xmlns:a="http://example.com/" xmlns:b="http://example.com/" + a:err="1" b:err="2"/> diff --git a/test/namespaces/reconcile/tests-to-c.xsl b/test/namespaces/reconcile/tests-to-c.xsl new file mode 100644 index 0000000..9a0d1c6 --- /dev/null +++ b/test/namespaces/reconcile/tests-to-c.xsl @@ -0,0 +1,275 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output method="text"/> + + <xsl:template match="/"> + <xsl:text><![CDATA[ +#include <libxml/parser.h> +#include <libxml/tree.h> +#include <libxml/xpath.h> +#include <libxml/xpathInternals.h> +]]> +</xsl:text> + <xsl:call-template name="serializer"/> + <xsl:apply-templates select="tests/test"/> + <xsl:text> + +int main(int argc, char **argv) {
</xsl:text> + <xsl:apply-templates select="tests/test" mode="call"/> + <xsl:text> + /* printf("finished.\n"); */ + return (0); +} +</xsl:text> + </xsl:template> + + <xsl:template match="tests/test" mode="call"> + <xsl:text> nsTest_</xsl:text> + <xsl:value-of select="@name"/> + <xsl:text>();
</xsl:text> + </xsl:template> + + <xsl:template name="xml-text"> + <xsl:param name="text"/> + <xsl:call-template name="replace-string"> + <!-- Substitute #10 for " --> + <xsl:with-param name="from" select="' '"/> + <xsl:with-param name="to" select="'" "'"/> + <xsl:with-param name="text"> + <xsl:call-template name="replace-string"> + <!-- Substitute " for \" --> + <xsl:with-param name="from" select="'"'"/> + <xsl:with-param name="to" select="'\"'"/> + <xsl:with-param name="text"> + <xsl:call-template name="replace-string"> + <!-- Remove tabs. --> + <xsl:with-param name="from" select="'	'"/> + <xsl:with-param name="to" select="''"/> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + </xsl:template> + + <xsl:template match="doc" mode="define"> + <xsl:text> xmlDocPtr </xsl:text> + <xsl:value-of select="@name"/> + <xsl:text>;
</xsl:text> + <xsl:text> const char * </xsl:text> + <xsl:value-of select="@name"/> + <xsl:text>_str = "</xsl:text> + <xsl:call-template name="xml-text"> + <xsl:with-param name="text" select="."/> + </xsl:call-template> + <xsl:text>";
</xsl:text> + </xsl:template> + + <xsl:template match="expected" mode="define"> + <xsl:text> const char * </xsl:text> + <xsl:text>exp_str = "</xsl:text> + <xsl:call-template name="xml-text"> + <xsl:with-param name="text" select="."/> + </xsl:call-template> + <xsl:text>";
</xsl:text> + </xsl:template> + + <xsl:template match="doc"> + <xsl:text> </xsl:text> + <xsl:value-of select="@name"/> + <xsl:text> = xmlReadDoc(BAD_CAST </xsl:text> + <xsl:value-of select="@name"/> + <xsl:text>_str, NULL, NULL, 0);
</xsl:text> + + <xsl:apply-templates select="following-sibling::*[1]"/> + + <xsl:text> xmlFreeDoc(</xsl:text> + <xsl:value-of select="@name"/> + <xsl:text>);
</xsl:text> + </xsl:template> + + <xsl:template match="xpath"> + </xsl:template> + + <xsl:template match="var" mode="define"> + <xsl:text> xmlNodePtr </xsl:text> + <xsl:value-of select="@name"/> + <xsl:text>;
</xsl:text> + </xsl:template> + + <xsl:template match="var"> + <xsl:if test="xpath"> + <!-- Create XPath context. --> + <xsl:text> /* Selecting node "</xsl:text><xsl:value-of select="@name"/><xsl:text>". */
</xsl:text> + <xsl:text> xp = xmlXPathNewContext(</xsl:text> + <xsl:value-of select="xpath/@doc"/> + <xsl:text>);
</xsl:text> + <!-- Register namespaces. --> + <xsl:for-each select="xpath/reg-ns"> + <xsl:text> xmlXPathRegisterNs(xp, BAD_CAST "</xsl:text> + <xsl:value-of select="@prefix"/> + <xsl:text>", BAD_CAST "</xsl:text> + <xsl:value-of select="@ns"/> + <xsl:text>");
</xsl:text> + </xsl:for-each> + <!-- Evaluate. --> + <xsl:text> </xsl:text> + <xsl:value-of select="@name"/> + <xsl:text> = nsSelectNode(xp, "</xsl:text> + <xsl:value-of select="xpath/@select-node"/> + <xsl:text>");
</xsl:text> + <xsl:text> xmlXPathFreeContext(xp);
</xsl:text> + </xsl:if> + <xsl:apply-templates select="following-sibling::*[1]"/> + </xsl:template> + + <xsl:template match="reconcile-ns"> + <xsl:text> /* Reconcile node "</xsl:text><xsl:value-of select="@ref"/><xsl:text>". */
</xsl:text> + <xsl:text> xmlDOMWrapReconcileNamespaces(NULL, </xsl:text> + <xsl:value-of select="@node"/> + <xsl:text>, 0);
</xsl:text> + <xsl:apply-templates select="following-sibling::*[1]"/> + </xsl:template> + + <xsl:template match="remove"> + <xsl:text> xmlDOMWrapRemoveNode(NULL, </xsl:text> + <xsl:value-of select="@node"/> + <xsl:text>->doc, </xsl:text> + <xsl:value-of select="@node"/> + <xsl:text>, 0);
</xsl:text> + <xsl:apply-templates select="following-sibling::*[1]"/> + </xsl:template> + + <xsl:template match="adopt"> + <xsl:text> /* Adopt "</xsl:text><xsl:value-of select="@node"/><xsl:text>". */
</xsl:text> + <xsl:text> xmlDOMWrapAdoptNode(NULL, </xsl:text> + <xsl:value-of select="@node"/> + <xsl:text>->doc, </xsl:text> + <xsl:value-of select="@node"/> + <xsl:text>, </xsl:text> + <xsl:value-of select="@dest-doc"/> + <xsl:text>, </xsl:text> + <xsl:choose> + <xsl:when test="@dest-parent"> + <xsl:value-of select="@dest-parent"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>NULL</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:text>, 0);
</xsl:text> + <xsl:apply-templates select="following-sibling::*[1]"/> + </xsl:template> + + <xsl:template match="append-child"> + <xsl:text> xmlAddChild(</xsl:text> + <xsl:value-of select="@parent"/> + <xsl:text>, </xsl:text> + <xsl:value-of select="@child"/> + <xsl:text>);
</xsl:text> + <xsl:apply-templates select="following-sibling::*[1]"/> + </xsl:template> + + <xsl:template match="expected"> + <xsl:text> /* Serialize "</xsl:text><xsl:value-of select="@doc"/><xsl:text>". */
</xsl:text> + <xsl:text> result_str = nsSerializeNode(xmlDocGetRootElement(</xsl:text> + <xsl:value-of select="@doc"/> + <xsl:text>));
</xsl:text> + <xsl:text> /* Compare result. */ + if (! xmlStrEqual(BAD_CAST result_str, BAD_CAST exp_str)) { + printf("FAILED\n"); + printf("%s\n", (const char *) result_str); + printf("- - -\n"); + printf("Expected:\n%s\n", exp_str); + printf("= = =\n"); + } + xmlFree(result_str);
</xsl:text> + </xsl:template> + + <!--******** + * TEST * + ********--> + <xsl:template match="test"> + <xsl:text>void nsTest_</xsl:text> + <xsl:value-of select="@name"/> + <xsl:text>(void) { + xmlChar * result_str; + xmlXPathContextPtr xp; + int memory;
</xsl:text> + <xsl:apply-templates select="*" mode="define"/> + <xsl:text> + memory = xmlMemUsed(); + xmlInitParser();

</xsl:text> + <xsl:apply-templates select="child::*[1]"/> + <xsl:text> + xmlCleanupParser(); + memory = xmlMemUsed() - memory; + + if (memory != 0) { + printf("## '%s' MEMORY leak: %d\n", "</xsl:text> + <xsl:value-of select="@name"/> + <xsl:text>", memory); + } +} +</xsl:text> + </xsl:template> + + <xsl:template name="serializer"> + <xsl:text> + +xmlChar * nsSerializeNode(xmlNodePtr node) { + xmlChar * ret; + + xmlOutputBufferPtr buf; + buf = xmlAllocOutputBuffer(NULL); + xmlNodeDumpOutput(buf, node->doc, node, 0, 0, NULL); + xmlOutputBufferFlush(buf); + ret = (xmlChar *) buf->buffer->content; + buf->buffer->content = NULL; + (void) xmlOutputBufferClose(buf); + return (ret); +} + +xmlNodePtr nsSelectNode(xmlXPathContextPtr xp, const char * xpath) { + xmlXPathObjectPtr xpres; + xmlNodePtr ret; + + xpres = xmlXPathEval(BAD_CAST xpath, xp); + ret = xpres->nodesetval->nodeTab[0]; + xmlXPathFreeObject(xpres); + return (ret); +} + +</xsl:text> + </xsl:template> + + <xsl:template name="replace-string"> + <xsl:param name="text"/> + <xsl:param name="from"/> + <xsl:param name="to"/> + + <xsl:choose> + <xsl:when test="contains($text, $from)"> + + <xsl:variable name="before" select="substring-before($text, $from)"/> + <xsl:variable name="after" select="substring-after($text, $from)"/> + <xsl:variable name="prefix" select="concat($before, $to)"/> + + <xsl:value-of select="$before"/> + <xsl:value-of select="$to"/> + <xsl:call-template name="replace-string"> + <xsl:with-param name="text" select="$after"/> + <xsl:with-param name="from" select="$from"/> + <xsl:with-param name="to" select="$to"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + +</xsl:stylesheet> diff --git a/test/namespaces/reconcile/tests.xml b/test/namespaces/reconcile/tests.xml new file mode 100644 index 0000000..c6f8c54 --- /dev/null +++ b/test/namespaces/reconcile/tests.xml @@ -0,0 +1,249 @@ +<?xml version="1.0"?> +<tests> + <test name="adopt_recon_default"> + + <doc name="doc1"><![CDATA[<p1 xmlns="urn:test:AAA"><a/></p1>]]></doc> + <doc name="doc2"><![CDATA[<p1 xmlns="urn:test:BBB"><b/></p1>]]></doc> + <doc name="doc3"><![CDATA[<p2 xmlns="urn:test:ZZZ"/>]]></doc> + <var name="a"> + <xpath doc="doc1" select-node="/a:p1/a:a"> + <reg-ns prefix="a" ns="urn:test:AAA"/> + </xpath> + </var> + <var name="b" > + <xpath doc="doc2" select-node="/b:p1/b:b"> + <reg-ns prefix="b" ns="urn:test:BBB"/> + </xpath> + </var> + <var name="p2"> + <xpath doc="doc3" select-node="/z:p2"> + <reg-ns prefix="z" ns="urn:test:ZZZ"/> + </xpath> + </var> + + <remove node="a"/> + <adopt dest-doc="doc3" node="a"/> + <append-child parent="p2" child="a"/> + + <!-- This time without a previous removing. --> + <adopt dest-doc="doc3" node="b"/> + <append-child parent="p2" child="b"/> + + <reconcile-ns node="p2"/> + <expected doc="doc3"><![CDATA[<p2 xmlns="urn:test:ZZZ"><a xmlns="urn:test:AAA"/><b xmlns="urn:test:BBB"/></p2>]]></expected> + </test> + + <test name="adopt_recon"> + <doc name="doc1"><![CDATA[<a:p1 xmlns:a="urn:test:AAA"><a:a/></a:p1>]]></doc> + <doc name="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA"/>]]></doc> + <var name="a"> + <xpath doc="doc1" select-node="/a:p1/a:a"> + <reg-ns prefix="a" ns="urn:test:AAA"/> + </xpath> + </var> + <var name="p2"> + <xpath doc="doc2" select-node="/a:p2"> + <reg-ns prefix="a" ns="urn:test:AAA"/> + </xpath> + </var> + <adopt dest-doc="doc2" node="a"/> + <append-child parent="p2" child="a"/> + <reconcile-ns node="a"/> + <expected doc="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA"><a:a/></a:p2>]]></expected> + </test> + + <test name="adopt_recon_attr"> + <doc name="doc1"><![CDATA[<p1 xmlns:b="urn:test:BBB" b:attr="marvin"/>]]></doc> + <doc name="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA"/>]]></doc> + <var name="attr"> + <xpath doc="doc1" select-node="/p1/@b:attr"> + <reg-ns prefix="b" ns="urn:test:BBB"/> + </xpath> + </var> + <var name="p2"> + <xpath doc="doc2" select-node="/a:p2"> + <reg-ns prefix="a" ns="urn:test:AAA"/> + </xpath> + </var> + <adopt dest-doc="doc2" node="attr" /> + <append-child parent="p2" child="attr"/> + <reconcile-ns node="p2"/> + <expected doc="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA" xmlns:b="urn:test:BBB" b:attr="marvin"/>]]></expected> + </test> + + <test name="adopt_recon_attr_2"> + <!-- Here we will specify a destination-parent for adoption. --> + <doc name="doc1"><![CDATA[<p1 xmlns:b="urn:test:BBB" b:attr="marvin"/>]]></doc> + <doc name="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA"/>]]></doc> + <var name="attr"> + <xpath doc="doc1" select-node="/p1/@b:attr"> + <reg-ns prefix="b" ns="urn:test:BBB"/> + </xpath> + </var> + <var name="p2"> + <xpath doc="doc2" select-node="/a:p2"> + <reg-ns prefix="a" ns="urn:test:AAA"/> + </xpath> + </var> + <adopt dest-doc="doc2" dest-parent="p2" node="attr" /> + <append-child parent="p2" child="attr"/> + <reconcile-ns node="p2"/> + <expected doc="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA" xmlns:b="urn:test:BBB" b:attr="marvin"/>]]></expected> + </test> + + <test name="adopt_recon_attr_3"> + <!-- Conflicting ns-prefixes for the added attribute. --> + <doc name="doc1"><![CDATA[<p1 xmlns:a="urn:test:AAA" a:attr="marvin"/>]]></doc> + <doc name="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:aaa"/>]]></doc> + <var name="attr"> + <xpath doc="doc1" select-node="/p1/@a:attr"> + <reg-ns prefix="a" ns="urn:test:AAA"/> + </xpath> + </var> + <var name="p2"> + <xpath doc="doc2" select-node="/a:p2"> + <reg-ns prefix="a" ns="urn:test:aaa"/> + </xpath> + </var> + <adopt dest-doc="doc2" node="attr" /> + <append-child parent="p2" child="attr"/> + <reconcile-ns node="p2"/> + <expected doc="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:aaa" xmlns:a1="urn:test:AAA" a1:attr="marvin"/>]]></expected> + </test> + + <test name="adopt_recon_attr_4"> + <!-- Qualified attribute added to default namespaced elem. --> + <doc name="doc1"><![CDATA[<p1 xmlns:a="urn:test:AAA" a:attr="marvin"/>]]></doc> + <doc name="doc2"><![CDATA[<p2 xmlns="urn:test:AAA"/>]]></doc> + <var name="attr"> + <xpath doc="doc1" select-node="/p1/@a:attr"> + <reg-ns prefix="a" ns="urn:test:AAA"/> + </xpath> + </var> + <var name="p2"> + <xpath doc="doc2" select-node="/a:p2"> + <reg-ns prefix="a" ns="urn:test:AAA"/> + </xpath> + </var> + <adopt dest-doc="doc2" node="attr" /> + <append-child parent="p2" child="attr"/> + <reconcile-ns node="p2"/> + <expected doc="doc2"><![CDATA[<p2 xmlns="urn:test:AAA" xmlns:a="urn:test:AAA" a:attr="marvin"/>]]></expected> + </test> + + <test name="adopt_recon_attr_5"> + <!-- Shadowed and conflicting prefix. dest-parent IS given. --> + <doc name="doc1"><![CDATA[<p1 xmlns:a="urn:test:AAA" a:attr="marvin"/>]]></doc> + <doc name="doc2"><![CDATA[<p2 xmlns:a="urn:test:AAA"><a:p3 xmlns:a="urn:test:ZZZ"/></p2>]]></doc> + <var name="attr"> + <xpath doc="doc1" select-node="/p1/@a:attr"> + <reg-ns prefix="a" ns="urn:test:AAA"/> + </xpath> + </var> + <var name="p3"> + <xpath doc="doc2" select-node="/p2/a:p3"> + <reg-ns prefix="a" ns="urn:test:ZZZ"/> + </xpath> + </var> + <adopt dest-doc="doc2" node="attr" dest-parent="p3"/> + <append-child parent="p3" child="attr"/> + <!-- Note that we don't need to reconcile here, since done during + adoption. --> + <expected doc="doc2"><![CDATA[ +<p2 xmlns:a="urn:test:AAA"> + <a:p3 xmlns:a="urn:test:ZZZ" xmlns:a1="urn:test:AAA" a1:attr="marvin"/> +</p2>]]></expected> + </test> + + <test name="adopt_recon_attr_6"> + <!-- Shadowed and conflicting prefix. dest-parent NOT given. --> + <doc name="doc1"><![CDATA[<p1 xmlns:a="urn:test:AAA" a:attr="marvin"/>]]></doc> + <doc name="doc2"><![CDATA[<p2 xmlns:a="urn:test:AAA"><a:p3 xmlns:a="urn:test:ZZZ"/></p2>]]></doc> + <var name="attr"> + <xpath doc="doc1" select-node="/p1/@a:attr"> + <reg-ns prefix="a" ns="urn:test:AAA"/> + </xpath> + </var> + <var name="p3"> + <xpath doc="doc2" select-node="/p2/a:p3"> + <reg-ns prefix="a" ns="urn:test:ZZZ"/> + </xpath> + </var> + <adopt dest-doc="doc2" node="attr"/> + <append-child parent="p3" child="attr"/> + <reconcile-ns node="p3"/> + <expected doc="doc2"><![CDATA[ +<p2 xmlns:a="urn:test:AAA"> + <a:p3 xmlns:a="urn:test:ZZZ" xmlns:a1="urn:test:AAA" a1:attr="marvin"/> +</p2>]]></expected> + </test> + + <test name="shadow_1"> + + <doc name="doc"><![CDATA[ +<foo xmlns:foo="urn:test:mine"> + <p xmlns:bar="urn:test:mine"/> + <a1> + <a2 xmlns:bar="urn:test:OTHER"> + <foo:a3/> + </a2> + </a1> +</foo> +]]></doc> + <var name="a1"> + <xpath doc="doc" select-node="/foo/a1"/> + </var> + <var name="p" > + <xpath doc="doc" select-node="/foo/p"/> + </var> + <remove node="a1"/> + <append-child parent="p" child="a1"/> + <reconcile-ns node="a1"/> + <expected doc="doc"><![CDATA[ +<foo xmlns:foo="urn:test:mine"> + <p xmlns:bar="urn:test:mine"> + <a1> + <a2 xmlns:bar="urn:test:OTHER"> + <foo:a3/> + </a2> + </a1> + </p> +</foo> +]]></expected> + </test> + + <test name="norm_1"> + + <doc name="doc"><![CDATA[ +<foo> + <p1 xmlns:a="urn:test:A" xmlns:b="urn:test:B" xmlns:c="urn:test:C"> + <a:a> + <b:b a:attr="dont" c:attr="panic"/> + </a:a> + </p1> + <p2/> +</foo> +]]></doc> + <var name="a"> + <xpath doc="doc" select-node="/foo/p1/a:a"> + <reg-ns prefix="a" ns="urn:test:A"/> + </xpath> + </var> + <var name="p2" > + <xpath doc="doc" select-node="/foo/p2"/> + </var> + <remove node="a"/> + <append-child parent="p2" child="a"/> + <reconcile-ns node="a"/> + <expected doc="doc"><![CDATA[ +<foo> + <p1 xmlns:a="urn:test:A" xmlns:b="urn:test:B" xmlns:c="urn:test:C"/> + <p2> + <a:a xmlns:a="urn:test:A"> + <b:b xmlns:b="urn:test:B" xmlns:c="urn:test:C" a:attr="dont" c:attr="panic"/> + </a:a> + </p2> +</foo> +]]></expected> + </test> +</tests> |