|
From: Palmer, E. <ep...@ri...> - 2010-04-25 12:19:07
|
I'm very new to xquery and am having problems understanding where to place the {} and getting output to serialize to xhtml
If I do
declare option exist:serialize "method=xhtml media-type=text/xml indent=yes";
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<ul>
{
for $bio in collection("/db/bios")
let $first := data($bio/data/bio/person/name/first)
let $last := data($bio/data/bio/person/name/last)
return <li> {$first} </li>
}
</ul>
</body>
</html>
The page source shows the <li></li> elements to be empty
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<ul>
<li></li>
<li></li>
However if I just change the first two lines to <html>
<html>
<head>
</head>
<body>
<ul>
{
for $bio in collection("/db/bios")
let $first := data($bio/data/bio/person/name/first)
let $last := data($bio/data/bio/person/name/last)
return <li> {$first} </li>
}
</ul>
</body>
</html>
The results are output as xml with the <li></li> filled in with the first name.
<html>
<head/>
<body>
<ul>
<li>Shari</li>
<li>Jonathan</li>
I've tried a lot of combinations but I think I'm my mental model of how to structure xquery code and where to place {} characters, etc. is not correct.
Thanks
Eric Palmer
U of Richmond
|