[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qexo-general] 2 times functions applying problems
From: |
Per Bothner |
Subject: |
Re: [Qexo-general] 2 times functions applying problems |
Date: |
Tue, 11 Mar 2003 20:25:56 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030210 |
Gregoire DUPE wrote:
When I use it once it works. But when I apply it a second time on the result
of the first run, it doesn't give the expected answer.
...
But the most surprising point, is that, if I copy/past the answer of the 1
time run in a file (called answer.xmi). And run my function on this new file
(see the code above). I get the result I'm expecting !
Your example is too complicated for me to be sure, but I have
a hunch that you're confusing a document node with the root
element.
If you have an xml file:
<?xml ...>
<html
<body>...</body>
<html>
and you read this with document(), you get a document node.
The child of this node is the root element i.e. <html>:
let $d := document("...")
let $body := $d/html/body return ...
This is loosely equivalent to:
let $e := <html><body>...</body></html>
let $body := $e/body return ...
The the missing /html/ in the second example. This is
because the <html><body>...</body></html> evaluates
to an <html>element node. It's child is the <body>,
not the <html> itself.
The CVS version has a document constructor, so you can do:
let $d := document { <html><body>...</body></html> }
let $body := $d/html/body return ...
This appears to be a common source of confusion.
--
--Per Bothner
address@hidden http://www.bothner.com/per/