Re: xquery returns xhtml, but some content is missing
2012-06-30 23:07:43 GMT
Looking at the code that does the serialization, it seems that it splits the parameters based on a space (" "). Thus how you have your doctype declared will probably cause issues. You should try replacing the spaces with the corresponding entity  :
IE:
declare option exist:serialize "method=xhtml
media-type=application/xhtml+xml omit-xml-declaration=no indent=yes doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
If this doesn't work, and the difference still seems to be the serialization, then the first thing todo is try and create a small reproducible test case.
For instance, testing with the document data inline:
let $doc-inline := <root><uid>blahblahblah</uid></root>(: One of the docs in /db/app/data :)
return
<html><body><p>{$doc/root/uid/text()}</p></body></html>
Then testing this with both types of serialization and send the results back to us.
Cheers,
Casey
hi
have an old query below that i thought used to work fine.
the xhtml document is returned, but it seems the line, <p> {
$doc/root/uid/text() } </p> has no content for the <p> tags.
the 'for' loop works as there is the correct number of <p> tag pairs
produced.
now then, if I remove all the xhtml serialization stuff and just return an
xml document, then it all works fine.
any ideas ?
(using latest trunk version)
---------------------
xquery version "1.0";
import module namespace xdb = "http://exist-db.org/xquery/xmldb";
declare option exist:serialize "method=xhtml
media-type=application/xhtml+xml omit-xml-declaration=no indent=yes
doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN
doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
let $isLoggedIn := xdb:login("xmldb:exist:///db", "auser", "")
let $col := collection("xmldb:exist:///db/app/data")
return
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Collection</title>
</head>
<body>
<p>collection</p>
<div>
{
for $doc in $col
return
<p>{ $doc/root/uid/text() }</p>
}
</div>
</body>
</html>
--
View this message in context: http://exist.2174344.n4.nabble.com/xquery-returns-xhtml-but-some-content-is-missing-tp4655583.html
Sent from the exist-open mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open
--
--
Casey Jordan
easyDITA a product of Jorsek LLC
"CaseyDJordan" on LinkedIn, Twitter & Facebook
(585) 348 7399
easydita.com
This message is intended only for the use of the Addressee(s) and may
contain information that is privileged, confidential, and/or exempt from
disclosure under applicable law. If you are not the intended recipient,
please be advised that any disclosure copying, distribution, or use of
the information contained herein is prohibited. If you have received
this communication in error, please destroy all copies of the message,
whether in electronic or hard copy format, as well as attachments, and
immediately contact the sender by replying to this e-mail or by phone.
Thank you.
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Exist-open mailing list Exist-open <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/exist-open
I tried this outside of the xhtml content:
let $foo := for $doc in $col return <p>{$doc/root/uid/text()}</p>
and then inserted $foo as suggested.
It works as you suspected and the text is shown; each line looks like
this (although it doesnt display correctly as xhtml <p> tag due to the
empty namespace i guess):
<p xmlns="">some text</p>
<p xmlns="">some more text</p>
.
.
which highlights the namespace issue you were referring to ?
So, i need to brush up on namespaces with regard to constructing
xquery results, the order in the xquery and serialization issues.
The source xml being written into the xhtml is stored in the db with
no namespace attached.
Just to help me along in this simple case, how would i get the
<p>some text</p> tag into the xhtml without the blank namespace
being inserted please ?
Thank you for your time and input. Much appreciated. Off to play some
more now :)
Chris H.
On 1 July 2012 03:10, Joe Wicentowski <joewiz <at> gmail.com> wrote:
> Hi Chris,
>
>> the xhtml document is returned, but it seems the line, <p> {
>> $doc/root/uid/text() } </p> has no content for the <p> tags.
> ...
>> <html xmlns="
RSS Feed