Casey Jordan | 1 Jul 2012 01:07

Re: xquery returns xhtml, but some content is missing

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

On Sat, Jun 30, 2012 at 4:26 PM, badbetty <bch <at> shroggslodge.freeserve.co.uk> wrote:
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
Joe Wicentowski | 1 Jul 2012 04:10
Picon
Gravatar

Re: xquery returns xhtml, but some content is missing

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="http://www.w3.org/1999/xhtml">
...
> {
> for $doc in $col
>  return
>  <p>{ $doc/root/uid/text() }</p>
> }
...

I think this is a namespace inheritance issue.  Your
$doc/root/uid/text() expression will inherit the HTML namespace given
their placement in the query.  Are root and uid both in the HTML
namespace?  If not, your query will return no results.  To avoid this,
define a variable (e.g., $foo) outside the html element, so that root
and uid are in the default element namespace (presumably, the empty
namespace); then reference the value inside the html element, and you
will be all set: <p>{ $foo }</p>.

Cheers,
Joe

------------------------------------------------------------------------------
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 | 1 Jul 2012 07:31

System backup without locking database?

I was wondering if it was possible yet to run a scheduled backup without having to run it as a system task (IE without locking the database). The main reason is that we have systems that are used globally, thus picking a time when there are no users in the system and it's ok to lock the database down is nearly impossible. 


Thanks,

Casey

-- 
--
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
Chris H. | 1 Jul 2012 11:10
Picon
Picon

Re: xquery returns xhtml, but some content is missing

Hi Joe

Now then,  I did wonder if it was a namespace issue when i walked away
from it for while-   i struggle with namespace 'interference'
syndrome  regularly ;-)

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="http://www.w3.org/1999/xhtml">
> ...
>> {
>> for $doc in $col
>>  return
>>  <p>{ $doc/root/uid/text() }</p>
>> }
> ...
>
> I think this is a namespace inheritance issue.  Your
> $doc/root/uid/text() expression will inherit the HTML namespace given
> their placement in the query.  Are root and uid both in the HTML
> namespace?  If not, your query will return no results.  To avoid this,
> define a variable (e.g., $foo) outside the html element, so that root
> and uid are in the default element namespace (presumably, the empty
> namespace); then reference the value inside the html element, and you
> will be all set: <p>{ $foo }</p>.
>
> Cheers,
> Joe

------------------------------------------------------------------------------
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/
Dmitriy Shabanov | 1 Jul 2012 14:36
Picon
Gravatar

Re: System backup without locking database?

Did you try http://exist-db.org/exist/backup.xml#d10422e602 ?

On Sun, Jul 1, 2012 at 10:31 AM, Casey Jordan <casey.jordan <at> jorsek.com> wrote:
I was wondering if it was possible yet to run a scheduled backup without having to run it as a system task (IE without locking the database). The main reason is that we have systems that are used globally, thus picking a time when there are no users in the system and it's ok to lock the database down is nearly impossible. 

--
Dmitriy Shabanov
------------------------------------------------------------------------------
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 | 1 Jul 2012 19:45

Re: System backup without locking database?

Of course. but as far as I can tell all backup procedures from the scheduler must be run as a system task....

On Sun, Jul 1, 2012 at 8:36 AM, Dmitriy Shabanov <shabanovd <at> gmail.com> wrote:
Did you try http://exist-db.org/exist/backup.xml#d10422e602 ?


On Sun, Jul 1, 2012 at 10:31 AM, Casey Jordan <casey.jordan <at> jorsek.com> wrote:
I was wondering if it was possible yet to run a scheduled backup without having to run it as a system task (IE without locking the database). The main reason is that we have systems that are used globally, thus picking a time when there are no users in the system and it's ok to lock the database down is nearly impossible. 

--
Dmitriy Shabanov



--
--
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
Ihe Onwuka | 1 Jul 2012 19:54

Trying to run XSLTForms Server side - Controller.xql issue?

I have generated an XForm from XQuery and it is stored on the database at db/apps/b2b/test.xhtml


XSLTForms is on the file system in the usual place at /eXist/webapp/xforms/xsltforms.

After painstakingly and carefully reading the URL Rewriting and MVC framework I tried placing the following controller.xql (irrelevant parts have been snipped) on the database; firstly in the db/apps collection and latterly the db/apps/b2b collection.

if ($exist:resource eq 'test.xhtml') then
        <dispatch xmlns="http://exist.sourceforge.net/NS/exist">
       <view>
          <forward servlet="XSLTServlet">
           (: Apply xsltforms.xsl stylesheet :)
             <set-attribute name="xslt.stylesheet" value="{$exist:root}/xforms/xsltforms/xsltforms.xsl"/>
     <set-attribute name="xslt.output.omit-xml-declaration" value="yes"/>
     <set-attribute name="xslt.output.indent" value="no"/>
     <set-attribute name="xslt.output.media-type" value="text/html"/>
     <set-attribute name="xslt.output.method" value="xhtml"/>
     <set-attribute name="xslt.baseuri" value="xsltforms/"/>
             <set-attribute name="xslt.xsltforms_home" value="webapp/xforms/xsltforms/"/>
    </forward>
       </view>
       <cache-control cache="yes"/>
    </dispatch>
else something else .......

Despite this the XForm is not being transformed. I don't know what some of the set-attribute options mean (e.g the last two). I'm wondering whether they also need to be prefixed with {$exist:root} but I think I could use some enlightenment on precisely what is wrong. 

This will not be my final configuration, I'm just trying to get the simplest thing that works.


------------------------------------------------------------------------------
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
Dmitriy Shabanov | 1 Jul 2012 20:30
Picon
Gravatar

Re: System backup without locking database?

system task should mean global lock. Backup by ConsistencyCheckTask have only READ locks, so you can remove type="system"

if that more than you can give for backup then you should use FS with snapshot feature, but before doing snapshot switch db to ServiceMode & sync everything to hard driver. Theoretically this require something from 1 to 60 seconds.

On Sun, Jul 1, 2012 at 10:45 PM, Casey Jordan <casey.jordan <at> jorsek.com> wrote:
Of course. but as far as I can tell all backup procedures from the scheduler must be run as a system task....


On Sun, Jul 1, 2012 at 8:36 AM, Dmitriy Shabanov <shabanovd <at> gmail.com> wrote:
Did you try http://exist-db.org/exist/backup.xml#d10422e602 ?


On Sun, Jul 1, 2012 at 10:31 AM, Casey Jordan <casey.jordan <at> jorsek.com> wrote:
I was wondering if it was possible yet to run a scheduled backup without having to run it as a system task (IE without locking the database). The main reason is that we have systems that are used globally, thus picking a time when there are no users in the system and it's ok to lock the database down is nearly impossible.

--
Dmitriy Shabanov
------------------------------------------------------------------------------
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
Chris H. | 1 Jul 2012 22:18
Picon
Picon

Fwd: xquery returns xhtml, but some content is missing

Me again Joe

I think i've sorted it.
As the xml in the database has no namespace,  its a 2 stage process
(unless you have better idea ?).

Grab the xml (or whatever is required from the xml) from the db
collection outside the xhtml namespace using:

   let $foo := for  $doc in $col  return $doc/root/uid/text()

Then loop over that construct in the xhtml namespace   i.e.  as i
originally was doing in the XHTML document part of the xquery:

<html xmlns="http://www.w3.org/1999/xhtml">
.
.
<div>
{ for $uidtext in $foo  return   <p>{$uid}</p> }
</div>
.
.
</html>

This seems to take care of the namespace issue and appears to work.
It seems a bit long winded, but I cant see how else to do it.
However,  it would make more sense and a much better/correct approach
to ensure I do use a namespace in the stored XML  and then ensure i
declare the namespace in the xquery for selection.

Thanks again
Chris

---------- Forwarded message ----------
From: Chris H. <bch <at> shroggslodge.freeserve.co.uk>
Date: 1 July 2012 10:10
Subject: Re: [Exist-open] xquery returns xhtml, but some content is missing
To: Joe Wicentowski <joewiz <at> gmail.com>
Cc: exist-open <at> lists.sourceforge.net

Hi Joe

Now then,  I did wonder if it was a namespace issue when i walked away
from it for while-   i struggle with namespace 'interference'
syndrome  regularly ;-)

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="http://www.w3.org/1999/xhtml">
> ...
>> {
>> for $doc in $col
>>  return
>>  <p>{ $doc/root/uid/text() }</p>
>> }
> ...
>
> I think this is a namespace inheritance issue.  Your
> $doc/root/uid/text() expression will inherit the HTML namespace given
> their placement in the query.  Are root and uid both in the HTML
> namespace?  If not, your query will return no results.  To avoid this,
> define a variable (e.g., $foo) outside the html element, so that root
> and uid are in the default element namespace (presumably, the empty
> namespace); then reference the value inside the html element, and you
> will be all set: <p>{ $foo }</p>.
>
> Cheers,
> Joe

------------------------------------------------------------------------------
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/
badbetty | 1 Jul 2012 22:33
Picon
Picon

Re: Fwd: xquery returns xhtml, but some content is missing

Following my last post -   i tested again by this time including a namespace
declaration at the beginning of the xquery and ensuring the  xml from the db  
that i'm pulling into xhtml  has same namespace.

It is then possible to put the for loop  back in the xhtml   sections as in
my original post.

I feel sure you are all more competent at this than me, but if this all
helps some one else then that's good stuff.

Thanks to all for your input and help.
Regards
Chris

------------------------------------    
original post with namspace addition *.
just requires the xml in the db is in the same namespace.

xquery version "1.0";

import module namespace xdb = "http://exist-db.org/xquery/xmldb";

*declare namespace myns="http://www.myurl.com/test";

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/myns:root/myns: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-tp4655583p4655593.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/

Gmane