[xquery-talk] Multiple computed attributes in Saxon 8.9

Claus claus.klingberg at gmail.com
Tue May 15 17:47:52 PDT 2007

Hi list,

I'm using Saxon and I get the following error that puzzles me:

Error on line 33 column 37 of file:/c:/work/pue-get-vehicle.xq:
  XPST0008: XQuery static error in #...ute pg {data($pg/v:Description#:
    Variable $pg has not been declared
Static error(s) in query

Here is part of the source where the error occurs - line #33 in the error
message is line #14 below:

 1 <models>
 2   {
 3     for $model in doc("pue_current/pue-vehicleModelList.xml")//v:VehicleModel
 4     let $br :=
 5     where some $modelbm in $model/v:DesignNumber satisfies
($modelbm/@ID = $bm/@ID)
 6     return
 7     <vehiclemodel>
 8       {
 9         (: TODO: make use of WHC and Plant attributes as well :)
10         let $pg :=
11         let $brand :=
12         return
13           attribute brand {data($brand/v:Description[@language="deu"])},
14           attribute pg {data($pg/v:Description[@language="deu"])},
15           attribute series {data($br/v:Description[@language="deu"])}
16       }
17     </vehiclemodel>
18   }
19 </models>

What really irritates me is that I can resolve the error by either deleting
line #14 (which seems reasonable) *or* by deleting line #13 (!!).

The error message says I haven't declared variable $pg, but I thought I did
in line #10. Removing line #14 obviously works, but so does removing line
#13. Looks like XQuery won't allow me to have more than two computed
attributes following each other.

What am I missing here?


More information about the talk mailing list