XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Florian SchöllhammerSubject: attribute()-tester does not work with default namespace ?
Author: Florian Schöllhammer
Date: 19 Aug 2004 04:13 PM
hello again, i have another question

lets assume that i have following xquery file:

<result>
{
let $e := <xml><length attr="inches">5</length></xml>
return
(
<h>{$e/child::length/attribute::attribute(attr)}</h>
)
}
</result>

then i will get the following result

<result>
<h attr="inches" />
</result>

i will get of course get the same if i write: $e/child::length/attribute::attr



okay, now i will use namespaces:


declare namespace data = "http://localhost/complex";

<result xmlns="http://localhost/complex">
{
let $e := <xml><length attr="inches">5</length></xml>
return
(
<h>{$e/child::data:length/attribute::attribute(attr)}</h>
)
}
</result>

and i got:

PHP Code:
<result xmlns="http://localhost/complex">
<h />
</result>


the attribute is MISSING !!! Why ????

so i tried the same as above: $e/child::data:length/attribute::attr
and then the attribute IS NOT MISSING !

hmm, so why isn't the attribute not selected, if i use the attribute()-tester ??

----

by the way, can anybody explain me, why i can not address attributes anymore (using @attribute), after i have defined a schema for default namespace?
import schema default element namespace = "http://localhost/complex" at "complex.xsd"

thanks a lot

Posttop
(Deleted User) Subject: Re: attribute()-tester does not work with default namespace ?
Author: (Deleted User)
Date: 19 Aug 2004 05:21 PM
Hi Florian,

>the attribute is MISSING !!! Why ????
>
>so i tried the same as above: $e/child::data:length/attribute::attr
>and then the attribute IS NOT MISSING !
>
>hmm, so why isn't the attribute not selected, if i use the
>attribute()-tester ??

The attribute() tester is following the same rules of the element() tester,
that is, it is using the default namespace declaration and changing attr
into data:attr (and it's not finding it, as attributes are by default in
the empty namespace). And this is clearly a bug; thanks for spotting it.

Alberto


 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.