Erin - It is definitely a namespace issue.  It sounds like your results are in 
the default namespace, but in your first example you are explicitly using the 
xhtml namespace for your xhtml structure, so you are unable to access the 
results in the different namespace.  I believe your second example will work if 
you set the response content type right before the <html> tag, like this:

xdmp:set-response-content-type( "text/html" )

(you may need a comma right after it, depending on how your page is coded).  

Hope that helps.
Mindie


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Sunday, November 02, 2008 8:29 PM
To: [email protected]
Subject: [MarkLogic Dev General] problem rendering as HTML

Hi All,
I've got a problem rendering some XHTML results as HTML--I think it might be a 
namespace problem, so I've been playing around with that all night, with no 
luck.  Here's my XQuery:

<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title> Search Results</title>
</head>
<body>
<h1><b>Search Results</b></h1>
<br/>
{
for $song in cts:search(/song, xdmp:get-request-field("search"))[1 to 100]
return <ul><li>{$song/name}</li></ul>
}
<br/>
<a href="browse.xqy">Return to Artist list</a>
</body>
</html>

When I attempt to hit that page (with the search URL parameter defined, I get 
back an HTML page with no results:

<html xmlns="http://www.w3.org/1999/xhtml";>
  <head>
    <title> Search Results</title>
  </head>
  <body><h1><b>Search Results</b></h1><br/><br/><a href="browse.xqy">Return to 
Artist list</a></body>
</html>

It's rendered properly as HTML in the browser.

If I remove the xmlns attribute, I get results, but they are in an XML tree.  
So here's my XQuery now:

<html>
<head>
<title> Search Results</title>
</head>
<body>
<h1><b>Search Results</b></h1>
<br/>
{
for $song in cts:search(/song, xdmp:get-request-field("search"))[1 to 100]
return <ul><li>{$song/name}</li></ul>
}
<br/>
<a href="browse.xqy">Return to Artist list</a>
</body>
</html>

This is the output from Firefox:

This XML file does not appear to have any style information associated with it. 
The document tree is shown below.
      
&#8722;
<html>
&#8722;
<head>
<title> Search Results</title>
</head>
&#8722;
<body>
&#8722;
<h1>
<b>Search Results</b>
</h1>
<br/>
&#8722;
<ul>
&#8722;
<li>
<name>Burning Down The House</name>
</li>
</ul>
&#8722;
<ul>
&#8722;
<li>
<name>Rock Steady</name>
</li>
</ul>
&#8722;
<ul>
&#8722;
<li>
<name>Three Time Loser</name>
</li>
etc....

So what am I missing?  It seems that there's some basic XHTML namespace issue 
I'm not addressing correctly.

Many thanks,
Erin
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

----------------------------------------------------------------------
NOTICE: This email message is for the sole use of the intended recipient(s) and 
may contain confidential and privileged information. Any unauthorized review, 
use, disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply email and destroy all copies of 
the original message.
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to