W3C home > Mailing lists > Public > www-ql@w3.org > January to March 2003

How to express in XQuery...

From: Michael Burbidge <mburbidg@adobe.com>
Date: Tue, 11 Feb 2003 11:33:11 -0800
To: www-ql@w3.org
Message-Id: <A8264DDE-3DF7-11D7-A9DD-003065F9651E@sea.adobe.com>


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-
Received on Tuesday, 11 February 2003 14:30:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 22 July 2006 00:10:18 GMT