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

optional attributes via function?

Dmitri.Colebatch at toyota.com.au Dmitri.Colebatch at toyota.com.au
Wed Sep 29 13:42:13 PDT 2004


xquery optional attribute
Per,

Sorry - got it sorted.  It was of course the missing {} around the
attribute values.

thanks for your help.

cheers
dim 

> -----Original Message-----
> From: http://xquery.com/mailman/listinfo/talk 
> [mailto:http://xquery.com/mailman/listinfo/talk] On Behalf Of Dmitri Colebatch
> Sent: Wednesday, 29 September 2004 12:31 PM
> To: http://xquery.com/mailman/listinfo/talk
> Subject: FW:  optional attributes via function?
> 
> Per,
> 
> having a little trouble with this....
> 
> > element widgetspecification {
> >    attribute validFrom myfn:transformDate($spec/VALIDFROM),
> >    myfn:outputValidToIfRequired($spec/VALIDTO),
> >    ...
> > }
> 
> using my input from the earlier email (repeated below) the following
> 'works':
> 
>   <widgetspecifications>
>   {
>     for $spec in $this//SPEC
>     return
>     <widgetspecification 
>       validFrom="{$spec/VALIDFROM/text()}" 
>       validTo="{$spec/VALIDTO/text()}">
>     </widgetspecification>          
>   }
>   </widgetspecifications>
> 
> however, when I try to incorporate your suggested syntax change:
> 
>   <widgetspecifications>
>   {
>     for $spec in $this//SPEC
>     return
>       element widgetspecification {
>         attribute validFrom $spec/VALIDFROM/text(),
>         attribute validTo $spec/VALIDTO/text()
>       }
>   }
>   </widgetspecifications>
> 
> I get an error.
> 
> I'm using BEA's engine which is based on the August 16, 2002 
> draft.  Does the above rely on something in a newer version 
> of the draft, or should it work on that version?  Or - am I 
> just missing something completely?
> 
> Am I right in thinking that the above is defined at 
> http://www.w3.org/TR/2002/WD-xquery-20020816/#id-sequencetype ?
> 
> thanks again,
> dim
> 
> input document:
> 
>   <SPECS>
>     <SPEC>
>       <VALIDFROM>20020801</VALIDFROM>
>       <VALIDTO>20020815</VALIDTO>
>       <morestuff />
>     </SPEC>
>     <SPEC>
>       <VALIDFROM>20020816</VALIDFROM>
>       <VALIDTO>99991231</VALIDTO>
>       <morestuff />
>     </SPEC>
>   </SPECS>
> 
> > 
> > -- 
> > 	--Per Bothner
> > http://xquery.com/mailman/listinfo/talk   http://per.bothner.com/
> > _______________________________________________
> > http://xquery.com/mailman/listinfo/talk
> > http://xquery.com/mailman/listinfo/talk
> > 
> 
> ######################################################################
> DISCLAIMER: 
> This email and any attachment may contain confidential information.
> If you are not the intended recipient you are not authorized 
> to copy or disclose all or any part of it without the prior 
> written consent of Toyota.
> 
> Opinions expressed in this email and any attachment are those 
> of the sender and not necessarily the opinions of Toyota.
> Please scan this email and any attachment for viruses.
> Toyota does not accept any responsibility for problems caused 
> by viruses, whether it is Toyota's fault or not.
> ######################################################################
> _______________________________________________
> http://xquery.com/mailman/listinfo/talk
> http://xquery.com/mailman/listinfo/talk
> 

######################################################################
DISCLAIMER: 
This email and any attachment may contain confidential information.
If you are not the intended recipient you are not authorized to copy
or disclose all or any part of it without the prior written consent
of Toyota.

Opinions expressed in this email and any attachment are those of the
sender and not necessarily the opinions of Toyota.
Please scan this email and any attachment for viruses.
Toyota does not accept any responsibility for problems
caused by viruses, whether it is Toyota's fault or not.
######################################################################


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-2011 All Rights Reserved.