- From: Michael Burbidge <mburbidg@adobe.com>
- Date: Tue, 11 Feb 2003 14:06:05 -0800
- To: Jerome Simeon <simeon@research.bell-labs.com>
- Cc: Michael Rys <mrys@microsoft.com>, Michael Burbidge <mburbidg@adobe.com>, www-ql@w3.org
Jerome,
The sequence in the parenthesis fixed my problem.
Sorry I mislead most of you concerning the problem in my code snippet.
I left out the { } around the FLWOR expression.
Thanks,
Michael-
On Tuesday, February 11, 2003, at 11:59 AM, Jerome Simeon wrote:
> Michael is right that you need to use a sequence. However, sequences
> bind less tightly than FLWOR so you need parenthesis as in:
>
> <users> {
> for $user in document("...")//users
> return ($user/name/text(), <br/>)
> } <users>
>
> Best regards,
> - Jerome
>
> On Tue, 2003-02-11 at 14:52, Michael Rys wrote:
>> Try:
>>
>> <users> {
>> for $user in document("...")//users
>> return $user/name/text(), <br/>
>> } <users>
>>
>> (for is part of the XQuery expression syntax, thus it needs to be
>> embedded inside {} inside a constructor.)
>>
>> Adding a PI then is straight forward (although I am not sure if our
>> prototype supports that yet).
>>
>> Best regards
>> Michael
>>
>>> -----Original Message-----
>>> From: Michael Burbidge [mailto:mburbidg@adobe.com]
>>> Sent: Tuesday, February 11, 2003 11:33 AM
>>> To: www-ql@w3.org
>>> Subject: How to express in XQuery...
>>>
>>>
>>>
>>> Given the following xml document
>>>
>>> <users>
>>> <name>Mike Jones</name>
>>> <name>Jon Stue</name>
>>> <users>
>>>
>>> How would one generate the following xml document
>>>
>>> <users>
>>> Mike Jones<br/>
>>> Jon Stue<br/>
>>> <users>
>>>
>>> I can't quite figure out how to express the text of the name and the
>>> <br/> element as part of a return expression.
>>> Here's what I have:
>>>
>>> <users>
>>> for $user in document("...")//users
>>> return { $user/name/text() }<br/>
>>> <users>
>>>
>>> But the expression in the return is not a valid expression, according
>>> to the Microsoft prototype.
>>>
>>> In addition how would one tack a processing instruction on the front.
>>> The following is also not a valid xquery expression.
>>>
>>> <?some-pi?>
>>> <users>
>>> for $user in document("...")//users
>>> return { $user/name/text() }<br/>
>>> <users>
>>>
>>> Thanks,
>>> Michael-
> --
> Jerome Simeon <simeon@research.bell-labs.com>
> Lucent Technologies
>
Received on Tuesday, 11 February 2003 17:03:02 UTC