[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Multiple computed attributes in Saxon 8.9

John Snelson john.snelson at oracle.com
Tue May 15 17:04:51 PDT 2007


  Multiple computed attributes in Saxon 8.9
Hi Claus,

Interestingly, this exact situation has come up a number of times 
recently on this mailing list. You are having problems with operator 
precedence - and need to enclose all of your attribute constructors in 
parentheses for them to be treated as part of the return expression.

John

Claus wrote:
> Hi list,
> 
> I'm using Saxon 8.9.0.3J 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 :=
> doc("pue_current/pue-stamm-br.xml")//v:Series[@ID=$model/@SeriesID]
> 5     where some $modelbm in $model/v:DesignNumber satisfies
> ($modelbm/@ID = $bm/@ID)part of the source where the error occurs - line #33 in the error
message is line #14 below:

[...]
> 6     return
> 7     <vehiclemodel>
> 8       {
> 9         (: TODO: make use of WHC and Plant attributes as well :)
> 10         let $pg :=
> doc("pue_current/pue-stamm-prod.xml")//v:ProductGroup[@ID=$br/@ProductGroupID] 
> 
> 11         let $brand :=
> doc("pue_current/pue-stamm-marken.xml")//v:Brand[@ID=$br/@BrandID]
> 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?
> 
> Thanks,
> Claus
> _______________________________________________
> http://x-query.com/mailman/listinfo/talk
> http://x-query.com/mailman/listinfo/talk



Purchase Stylus Studio Online Today!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.