Attributes in exist namespace are lost

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Attributes in exist namespace are lost

Jean-Christophe Kermagoret-2
Hello,
I'm using the CVS version I checkout about two weeks ago.

When I run this simple xquery script :

xquery version "1.0";
declare namespace exist="http://exist.sourceforge.net/NS/exist";
<exist:result exist:hits="40" exist:start="1" exist:count="5">
        hello
</exist:result>

I get the following result :
<exist:result xmlns:exist="http://exist.sourceforge.net/NS/exist">
        hello
</exist:result>

Attributes are not kept.

If i replace exist namespace by another one, for example dummy, all
works fine.

Why ?

--

BlueXML
Jean-Christophe Kermagoret
Directeur associé
[hidden email]



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Attributes in exist namespace are lost

Pierrick Brihaye
Hi,

Jean-Christophe Kermagoret a écrit :

 > When I run this simple xquery script :
 >
 > xquery version "1.0";
 > declare namespace exist="http://exist.sourceforge.net/NS/exist";
 > <exist:result exist:hits="40" exist:start="1" exist:count="5">
 >     hello
 > </exist:result>
 >
 > I get the following result :
 > <exist:result xmlns:exist="http://exist.sourceforge.net/NS/exist">
 >     hello
 > </exist:result>
 >
 > Attributes are not kept.
 >
 > If i replace exist namespace by another one, for example dummy, all
 > works fine.

Intellectually, I wonder if one should be allowed to use eXist's
namespace for his own needs :-) Technically, I'm suprised that your
(re)declare statement doesn't raise an error : I'm tracking this.

 > Why ?

Technically, the stripping is done in org.exist.memtree.MemTreeBuilder,
line 127.

 > I'm using the CVS version I checkout about two weeks ago.

You should update : many features tending to specs-compliance have been
added.

Cheers,

p.b.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Attributes in exist namespace are lost

Jean-Christophe Kermagoret-2
Pierrick Brihaye a écrit :

> Hi,
>
> Jean-Christophe Kermagoret a écrit :
>
>  > When I run this simple xquery script :
>  >
>  > xquery version "1.0";
>  > declare namespace exist="http://exist.sourceforge.net/NS/exist";
>  > <exist:result exist:hits="40" exist:start="1" exist:count="5">
>  >     hello
>  > </exist:result>
>  >
>  > I get the following result :
>  > <exist:result xmlns:exist="http://exist.sourceforge.net/NS/exist">
>  >     hello
>  > </exist:result>
>  >
>  > Attributes are not kept.
>  >
>  > If i replace exist namespace by another one, for example dummy, all
>  > works fine.
>
> Intellectually, I wonder if one should be allowed to use eXist's
> namespace for his own needs :-)
I agree with you but I have a stylesheet that uses this tag and I didn't
want to update it. Finally, I updated it because of this intellectual
annoyance :-)

> Technically, I'm suprised that your
> (re)declare statement doesn't raise an error : I'm tracking this.
>
>  > Why ?
>
> Technically, the stripping is done in org.exist.memtree.MemTreeBuilder,
> line 127.
>
>  > I'm using the CVS version I checkout about two weeks ago.
>
> You should update : many features tending to specs-compliance have been
> added.
Ok
>
> Cheers,
>
> p.b.

Jean-Christophe
--

BlueXML
Jean-Christophe Kermagoret
Directeur associé
[hidden email]



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Attributes in exist namespace are lost

wolfgangmm
In reply to this post by Jean-Christophe Kermagoret-2
Hi,

> When I run this simple xquery script :
>
> xquery version "1.0";
> declare namespace exist="http://exist.sourceforge.net/NS/exist";
> <exist:result exist:hits="40" exist:start="1" exist:count="5">
>         hello
> </exist:result>
>
> I get the following result :
> <exist:result xmlns:exist="http://exist.sourceforge.net/NS/exist">
>         hello
> </exist:result>
>
> Attributes are not kept.

Yes, eXist strips all attributes within its own namespace URI. The
reason for this behaviour is that the serializer might add exist:match
elements and/or exist:id attributes when serializing query results. If
you store these query results back into the db, then serialize them
again, you may get duplicate exist:match elements and/or attributes.
The indexer is thus configured to ignore those nodes.

However, I see the need to declare the exist namespace, not in XQuery,
but in XSLT stylesheets. I had the same problem a few days ago, when I
tried to store an XSLT in the database, which needs xmlns:exist to be
declared.

I have thus changed the behaviour in my local code to have the
xmlns:exist preserved in my stylesheet. I will commit this code later
(needs some cleanup).

Wolfgang


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open