function idref() and one-to-many
Sunday, 2 February 2014 · 2 messages
TG
Tsvetanka Georgieva-Trifonova2 Feb 2014 19:59 #
Hi BaseX,
My question is about function
idref().
How it should be
applied in case of one-to-many relationships?
For example:
<root>
<a id = "a1" idref =
"b1"> aaa1</a>
<a id = "a2" idef =
"b1">aaa2</a>
<a id = "a3" idef=
"b2"> aaa3</a>
<b id = "b1" idref = "a1
a2">bb1</b>
<b id = "b2" idref =
"a3">bb2</b>
</root>
The expression:
idref("a3")/..
gives the following result:
<b
id="b2" idref="a3">bb2</b>
But the expression:
idref("a1")/..
does not give any
result.
Thanks & regards,
Tsvetanka
NJ
Neven Jovanović2 Feb 2014 20:32 #
Zdrasti Tsvetanka!
I think your problem is a question of XQuery, and not BaseX. When I run the following script:
let $i := <root>
<a id = "a1" idref = "b1"> aaa1</a>
<a id = "a2" idef = "b1">aaa2</a>
<a id = "a3" idef= "b2"> aaa3</a>
<b id = "b1" idref = "a1 a2">bb1</b>
<b id = "b2" idref = "a3">bb2</b>
</root>
return $i/*[matches(@idref, 'a1')]BaseX produces the result:
<b id="b1" idref="a1 a2">bb1</b>
The same happens when I use expression $i/*[contains(@idref, 'a1')].
'a1' is only part of the @idref value.
Best, Neven
Neven Jovanovic
Zagreb
Hrvatska / Croatia
Quoted text · Tsvetanka Georgieva-Trifonova · 29 lines
On 2 February 2014 18:59, Tsvetanka Georgieva-Trifonova <cvetygeorg at yahoo.com> wrote: > Hi BaseX, > My question is about function idref(). > How it should be applied in case of one-to-many relationships? > For example: > <root> > <a id = "a1" idref = "b1"> aaa1</a> > <a id = "a2" idef = "b1">aaa2</a> > <a id = "a3" idef= "b2"> aaa3</a> > <b id = "b1" idref = "a1 a2">bb1</b> > <b id = "b2" idref = "a3">bb2</b> > </root> > The expression: > idref("a3")/.. > gives the following result: > <b id="b2" idref="a3">bb2</b> > But the expression: > idref("a1")/.. > does not give any result. > > Thanks & regards, > Tsvetanka > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Written for BaseX 7.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery