Error by retrieving an attribute of the element returned by the root function
Monday, 21 November 2011 · 4 messages
TN
Truong An Nguyen21 Nov 2011 10:25 #
Hi,
In my xquery, I use the root() function to return the root element of an element. I could get the root element, but I couldn't get any attributes of it.
For example:
for $value in collection()/otx/imports/import
let $otx:=root($value)
return $otx/@packageThanks
Cheers,
An
LL
Lukas Lewandowski21 Nov 2011 10:34 #
Hi An,
the root function returns the root of the tree to which the current node belongs, usually be a document node. You can retrieve the attribute according to your root element e.g. by $otx/ROOT_ELEMENT/@package, where ROOT_ELEMENT ist the root element of your document.
Lukas
2011/11/21 Truong An Nguyen <ngtruongan at gmail.com>
Quoted text · Truong An Nguyen · 22 lines
> Hi, > > In my xquery, I use the root() function to return the root element of an > element. I could get the root element, but I couldn't get any attributes > of it. > > For example: > for $value in collection()/otx/imports/import > let $otx:=root($value) > return $otx/@package > > Thanks > > Cheers, > An > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
LL
Lukas Lewandowski21 Nov 2011 14:59 #
Any ideas?
Anfang der weitergeleiteten E-Mail:
Quoted text · Lukas Lewandowski · 45 lines
> Von: Truong An Nguyen <ngtruongan at gmail.com> > Betreff: Re: [basex-talk] Error by retrieving an attribute of the element returned by the root function > Datum: 21. November 2011 14:38:51 MEZ > An: Lukas Lewandowski <lukas.lewandowski at uni-konstanz.de> > > Thanks very much for your response. > > How can I use "instance of" with Basex? I can not do: $a instance of Action. Action an abstract ComplexType. > > Thanks > > An > > > > On Mon, Nov 21, 2011 at 10:34 AM, Lukas Lewandowski <lukas.lewandowski at uni-konstanz.de> wrote: > Hi An, > > the root function returns the root of the tree to which the current node belongs, usually be a document node. You can retrieve the attribute according to your root element e.g. by $otx/ROOT_ELEMENT/@package, where ROOT_ELEMENT ist the root element of your document. > > Lukas > > > 2011/11/21 Truong An Nguyen <ngtruongan at gmail.com> > Hi, > > In my xquery, I use the root() function to return the root element of an element. I could get the root element, but I couldn't get any attributes of it. > > For example: > for $value in collection()/otx/imports/import > let $otx:=root($value) > return $otx/@package > > Thanks > > Cheers, > An > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > >
DP
Dimitar Popov21 Nov 2011 15:13 #
This might help: http://www.w3.org/TR/xquery/#id-typeswitch
Dimitar
Quoted text · Lukas Lewandowski · 55 lines
On Nov 21, 2011, at 2:59 PM, Lukas Lewandowski wrote: > Any ideas? > > Anfang der weitergeleiteten E-Mail: > >> Von: Truong An Nguyen <ngtruongan at gmail.com> >> Betreff: Re: [basex-talk] Error by retrieving an attribute of the element returned by the root function >> Datum: 21. November 2011 14:38:51 MEZ >> An: Lukas Lewandowski <lukas.lewandowski at uni-konstanz.de> >> >> Thanks very much for your response. >> >> How can I use "instance of" with Basex? I can not do: $a instance of Action. Action an abstract ComplexType. >> >> Thanks >> >> An >> >> >> >> On Mon, Nov 21, 2011 at 10:34 AM, Lukas Lewandowski <lukas.lewandowski at uni-konstanz.de> wrote: >> Hi An, >> >> the root function returns the root of the tree to which the current node belongs, usually be a document node. You can retrieve the attribute according to your root element e.g. by $otx/ROOT_ELEMENT/@package, where ROOT_ELEMENT ist the root element of your document. >> >> Lukas >> >> >> 2011/11/21 Truong An Nguyen <ngtruongan at gmail.com> >> Hi, >> >> In my xquery, I use the root() function to return the root element of an element. I could get the root element, but I couldn't get any attributes of it. >> >> For example: >> for $value in collection()/otx/imports/import >> let $otx:=root($value) >> return $otx/@package >> >> Thanks >> >> Cheers, >> An >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Written for BaseX 7.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery