[xquery-talk] optional attributes via function?
Dmitri.Colebatch at toyota.com.au
Dmitri.Colebatch at toyota.com.au
Wed Sep 29 13:42:13 PDT 2004
Per,
Sorry - got it sorted. It was of course the missing {} around the
attribute values.
thanks for your help.
cheers
dim
> -----Original Message-----
> From: talk-bounces at xquery.com
> [mailto:talk-bounces at xquery.com] On Behalf Of Dmitri Colebatch
> Sent: Wednesday, 29 September 2004 12:31 PM
> To: talk at xquery.com
> Subject: FW: [xquery-talk] 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
> > per at bothner.com http://per.bothner.com/
> > _______________________________________________
> > talk at xquery.com
> > 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.
> ######################################################################
> _______________________________________________
> talk at xquery.com
> 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.
######################################################################
More information about the talk
mailing list