Re: node push down/pull up

Tak-po Li <[email protected]> Mon, 13 Jul 2009 21:53:56 -0400
Newsgroups gmane.text.xml.xindice.user
Message-ID <[email protected]>
--00163646bf8a21b7fe046ea0b63a
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Thanks, Natalia, for your detail explanation.  If I understand it right, we
use variable Var to point to the portion of the tree that we want to keep
and build the new tree with new node B and Var.  Question: Do we create a
duplicate tree and delete the old one or just switch the pointers around?

Thanks again.

Tak


On Mon, Jul 13, 2009 at 8:35 AM, Natalia Shilenkova
<[email protected]>wrote:

> Do you use XUpdate to update documents? If so, you can try this query:
>
> <xupdate:modifications version="1.0"
> xmlns:xupdate="http://www.xmldb.org/xupdate">
>
>  <xupdate:variable name="var" select="/a/*"/>
>
>  <xupdate:remove select="/a/*"/>
>  <xupdate:append select="/a">
>    <b></b>
>  </xupdate:append>
>  <xupdate:append select="/a/b">
>    <xupdate:value-of select="$var"/>
>  </xupdate:append>
> </xupdate:modifications>
>
> Regards,
> Natalia
>
>
> On Sat, Jul 11, 2009 at 10:34 AM, Tak-po Li<[email protected]> wrote:
> >
> > I am new with xindice.  What is the best way to insert/remove a node
> level?
> >
> > As an example, make
> >   <a>
> >     <m>
> >       ....
> >     </m>
> >   </a>
> > into
> >   <a>
> >     <b>
> >     <m>
> >       ....
> >     </m>
> >     </b>
> >   </a>
> > and vice verse.
> >
> > Thanks,
> >
> > Tak
> >
> >
>

--00163646bf8a21b7fe046ea0b63a
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>=A0</div>
<div>=A0</div>
<div>Thanks, Natalia, for your detail explanation.=A0 If I understand it ri=
ght, we use variable Var to point to the portion of the tree that we want t=
o keep and build the=A0new tree with new node B and Var.=A0 Question:=A0Do =
we create=A0a duplicate tree and delete the old one=A0or just switch the po=
inters around?</div>

<div>=A0</div>
<div>Thanks again.<br><br>Tak</div>
<div>=A0</div>
<div>=A0</div>
<div class=3D"gmail_quote">On Mon, Jul 13, 2009 at 8:35 AM, Natalia Shilenk=
ova <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]">nshilenk=
[email protected]</a>&gt;</span> wrote:<br>
<blockquote style=3D"BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex=
; PADDING-LEFT: 1ex" class=3D"gmail_quote">Do you use XUpdate to update doc=
uments? If so, you can try this query:<br><br>&lt;xupdate:modifications ver=
sion=3D&quot;1.0&quot;<br>
xmlns:xupdate=3D&quot;<a target=3D"_blank" href=3D"http://www.xmldb.org/xup=
date">http://www.xmldb.org/xupdate</a>&quot;&gt;<br><br>=A0&lt;xupdate:vari=
able name=3D&quot;var&quot; select=3D&quot;/a/*&quot;/&gt;<br><br>=A0&lt;xu=
pdate:remove select=3D&quot;/a/*&quot;/&gt;<br>
=A0&lt;xupdate:append select=3D&quot;/a&quot;&gt;<br>=A0 =A0&lt;b&gt;&lt;/b=
&gt;<br>=A0&lt;/xupdate:append&gt;<br>=A0&lt;xupdate:append select=3D&quot;=
/a/b&quot;&gt;<br>=A0 =A0&lt;xupdate:value-of select=3D&quot;$var&quot;/&gt=
;<br>=A0&lt;/xupdate:append&gt;<br>
&lt;/xupdate:modifications&gt;<br><br>Regards,<br><font color=3D"#888888">N=
atalia<br></font>
<div>
<div></div>
<div class=3D"h5"><br><br>On Sat, Jul 11, 2009 at 10:34 AM, Tak-po Li&lt;<a=
 target=3D"_blank" href=3D"http://takpo.li/">takpo.li</a>@<a target=3D"_bla=
nk" href=3D"http://gmail.com/">gmail.com</a>&gt; wrote:<br>&gt;<br>&gt; I a=
m new with xindice.=A0 What is the best way to insert/remove a node level?<=
br>
&gt;<br>&gt; As an example, make<br>&gt; =A0 &lt;a&gt;<br>&gt; =A0 =A0 &lt;=
m&gt;<br>&gt; =A0=A0=A0=A0=A0 ....<br>&gt; =A0 =A0 &lt;/m&gt;<br>&gt; =A0 &=
lt;/a&gt;<br>&gt; into<br>&gt; =A0 &lt;a&gt;<br>&gt; =A0=A0=A0 &lt;b&gt;<br=
>&gt; =A0 =A0 &lt;m&gt;<br>&gt; =A0=A0=A0=A0=A0 ....<br>
&gt; =A0 =A0 &lt;/m&gt;<br>&gt; =A0 =A0 &lt;/b&gt;<br>&gt; =A0 &lt;/a&gt;<b=
r>&gt; and vice verse.<br>&gt;<br>&gt; Thanks,<br>&gt;<br>&gt; Tak<br>&gt;<=
br>&gt;<br></div></div></blockquote></div><br>

--00163646bf8a21b7fe046ea0b63a--