Subject: [xsl] FW: [Sedna-discussion] Strange issue when declaring default element namespace From: "Robby Pelssers" <robby.pelssers@xxxxxxxxx> Date: Wed, 29 Jun 2011 23:26:09 +0200 |
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.Pelssers@xxxxxxx] 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@xxxxxxxxx] Sent: Wednesday, June 29, 2011 11:11 PM To: Robby Pelssers Cc: sedna-discussion@xxxxxxxxxxxxxxxxxxxxx; 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@xxxxxxxxx<mailto:shcheklein@xxxxxxxxx>] Sent: Wednesday, June 29, 2011 10:57 PM To: Robby Pelssers Cc: sedna-discussion@xxxxxxxxxxxxxxxxxxxxx<mailto:sedna-discussion@xxxxxxxxxxxxxx rge.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@xxxxxxxxx<mailto:shcheklein@xxxxxxxxx>] Sent: Wednesday, June 29, 2011 8:30 PM To: Robby Pelssers Cc: sedna-discussion@xxxxxxxxxxxxxxxxxxxxx<mailto:sedna-discussion@xxxxxxxxxxxxxx rge.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.Pelssers@xxxxxxx<mailto:Robby.Pelssers@xxxxxxx>> 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@xxxxxxxxx<mailto:shcheklein@xxxxxxxxx>] Sent: Wednesday, June 29, 2011 7:19 PM To: Robby Pelssers Cc: sedna-discussion@xxxxxxxxxxxxxxxxxxxxx<mailto:sedna-discussion@xxxxxxxxxxxxxx rge.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@xxxxxxxxxxxxxxxxxxxxx<mailto:Sedna-discussion@xxxxxxxxxxxxxx rge.net> https://lists.sourceforge.net/lists/listinfo/sedna-discussion
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xmlns="" added to output, David Carlisle | Thread | Re: [xsl] FW: [Sedna-discussion] St, Andrew Welch |
Re: [xsl] How to pass an XPath as a, Hermann Stamm-Wilbra | Date | Re: [xsl] FW: [Sedna-discussion] St, Andrew Welch |
Month |