xsl-list
[Top] [All Lists]

[xsl] FW: [Sedna-discussion] Strange issue when declaring default element namespace

2011-06-29 16:29:40
Hi all,

I wanted to verify that my problem discussed in below thread is actually not a 
bug but supposed to work like that.  Can someone confirm below findings?  I 
think this question applies to several mailinglists (xquery/ xslt/ sedna).

Thx in advance,
Robby Pelssers


-----Oorspronkelijk bericht-----
Van: Robby Pelssers [mailto:Robby(_dot_)Pelssers(_at_)nxp(_dot_)com]
Verzonden: wo 29-6-2011 23:13
Aan: Robby Pelssers
Onderwerp: FW: [Sedna-discussion] Strange issue when declaring default element 
namespace
 


From: Ivan Shcheklein [mailto:shcheklein(_at_)gmail(_dot_)com]
Sent: Wednesday, June 29, 2011 11:11 PM
To: Robby Pelssers
Cc: sedna-discussion(_at_)lists(_dot_)sourceforge(_dot_)net; Ivan Lagunov
Subject: Re: [Sedna-discussion] Strange issue when declaring default element 
namespace

Yes, as far as I understand. To be sure I've tested it on several 
databases/engines. I'm 100% sure that prolog declaration influences names in 
XPath. But I didn't know that xmlns attribute overrides locally value of the 
default element namespace as well.

You are welcome to ask this question on any other XQuery/XSLT forum. Let us 
know results.

Hi Ivan,

Is this supposed to work this way?  Just to summarize by giving a small example.


(1)    I have a collection of documents  of schema A in XML DB

(2)    I want to generate  documents of schema B having some specific namespace

Does xquery not provide this option without having to use 'ugly' [my personal 
opinion] workarounds?  Actually I would expect that 'declaring a default 
element namespace' was only targeting the output (elements) and not the input 
(elements) but my assumption could be wrong.

I will also share these findings on the XSLT mailing list just to be sure.

Thx for your fast follow-up on my issues so far.

To be continued,
Robby Pelssers



From: Ivan Shcheklein 
[mailto:shcheklein(_at_)gmail(_dot_)com<mailto:shcheklein(_at_)gmail(_dot_)com>]
Sent: Wednesday, June 29, 2011 10:57 PM

To: Robby Pelssers
Cc: 
sedna-discussion(_at_)lists(_dot_)sourceforge(_dot_)net<mailto:sedna-discussion(_at_)lists(_dot_)sourceforge(_dot_)net>;
 Ivan Lagunov
Subject: Re: [Sedna-discussion] Strange issue when declaring default element 
namespace

Robby,

I was not correct. xmlns overrides default element namespace value for 
everything inside the constructor expression. In this case it's just the same 
as "declare default element" prolog declaration.

The only way I see is to use wildcards:

import module namespace demoboards= "http://www.nxp.com/demoboards";;
let $results := demoboards:filterByName(demoboards:getDemoboards(), 'adc0')
return <results  xmlns="http://www.nxp.com";>{ for $result in $results return 
<id>{$result/*:DemoboardInformation/*:Name/text()}</id>} </results>

Ivan Shcheklein,
Sedna Team

Hi Ivan,

I have sent the testdata to your gmail account for protection of the data.  I 
actually tested adding the namespace directly on the element a few days ago. 
But that didn't work so that's why I was trying the approach setting the 
namespace through the xmldb API.

We are using release 3.4 of Sedna just to be sure and the latest (1.2.4) Sedna 
xmldb api from Charles Foster.

Kind regards,
Robby

From: Ivan Shcheklein 
[mailto:shcheklein(_at_)gmail(_dot_)com<mailto:shcheklein(_at_)gmail(_dot_)com>]
Sent: Wednesday, June 29, 2011 8:30 PM

To: Robby Pelssers
Cc: 
sedna-discussion(_at_)lists(_dot_)sourceforge(_dot_)net<mailto:sedna-discussion(_at_)lists(_dot_)sourceforge(_dot_)net>;
 Ivan Lagunov
Subject: Re: [Sedna-discussion] Strange issue when declaring default element 
namespace

Ok, can you send some sample data and demoboards:filterByName(), 
demoboards:getDemoboards() to reproduce this?
On Wed, Jun 29, 2011 at 9:31 PM, Robby Pelssers 
<Robby(_dot_)Pelssers(_at_)nxp(_dot_)com<mailto:Robby(_dot_)Pelssers(_at_)nxp(_dot_)com>>
 wrote:
Hi Ivan,

I just tried the following queries and still expect we are dealing with a bug.

import module namespace demoboards= "http://www.nxp.com/demoboards";;
let $results := demoboards:filterByName(demoboards:getDemoboards(), 'adc0')
return <results>{ for $result in $results return 
<id>{$result/DemoboardInformation/Name/text()}</id>} </results>

<results>
  <id>ADC0801S040</id>
  <id>ADC0804S030</id>
  <id>ADC0804S040</id>
  <id>ADC0804S050</id>
  <id>ADC0808S125</id>
  <id>ADC0808S250</id>
</results>

import module namespace demoboards= "http://www.nxp.com/demoboards";;
let $results := demoboards:filterByName(demoboards:getDemoboards(), 'adc0')
return <results  xmlns="http://www.nxp.com";>{ for $result in $results return 
<id>{$result/DemoboardInformation/Name/text()}</id>} </results>

<results xmlns="http://www.nxp.com";>
  <id/>
  <id/>
  <id/>
  <id/>
  <id/>
  <id/>
</results>

From: Ivan Shcheklein 
[mailto:shcheklein(_at_)gmail(_dot_)com<mailto:shcheklein(_at_)gmail(_dot_)com>]
Sent: Wednesday, June 29, 2011 7:19 PM
To: Robby Pelssers
Cc: 
sedna-discussion(_at_)lists(_dot_)sourceforge(_dot_)net<mailto:sedna-discussion(_at_)lists(_dot_)sourceforge(_dot_)net>;
 Ivan Lagunov
Subject: Re: [Sedna-discussion] Strange issue when declaring default element 
namespace

Hi Robby,

The default element namespace declaration influences all unprefixed element 
names. Including all names in XPath: $result/DemoboardInformation/Name/text() 
(I mean DemoboardInformation and Name). If your data doesn't contain namespaces 
at all it's better for you to declare default element namespace right within 
the constructor:

...
return <result xmlns="....">{...}</result>
...

Ivan Shcheklein,
Sedna Team

Hi all,

I am a bit puzzled why the query below returns:

import module namespace demoboards= "http://www.nxp.com/demoboards";;
let $results := demoboards:filterByName(demoboards:getDemoboards(), 'adc0')
return <results>{ for $result in $results return 
<id>{$result/DemoboardInformation/Name/text()}</id>} </results>

<results>
  <id>ADC0801S040</id>
  <id>ADC0804S030</id>
  <id>ADC0804S040</id>
  <id>ADC0804S050</id>
  <id>ADC0808S125</id>
  <id>ADC0808S250</id>
</results>

If I add a default element namespace I still find the same amount of results 
but all expressions are evaluated 'empty'

import module namespace demoboards= "http://www.nxp.com/demoboards";;
declare default element namespace "http://www.nxp.com";;
let $results := demoboards:filterByName(demoboards:getDemoboards(), 'adc0')
return <results>{ for $result in $results return 
<id>{$result/DemoboardInformation/Name/text()}</id>} </results>

<results xmlns="http://www.nxp.com";>
  <id/>
  <id/>
  <id/>
  <id/>
  <id/>
  <id/>
</results>

Am I misunderstanding something here or is this a bug in Sedna?

Kind regards,
Robby Pelssers

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Sedna-discussion mailing list
Sedna-discussion(_at_)lists(_dot_)sourceforge(_dot_)net<mailto:Sedna-discussion(_at_)lists(_dot_)sourceforge(_dot_)net>
https://lists.sourceforge.net/lists/listinfo/sedna-discussion






--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>