Hi,
I am displaying html from transformed content.
*module namespace **jq* = " http://www.architextus.com/xquery/library/how2_jquery"; *declare namespace **rest*="http://exquery.org/ns/restxq";
*declare* %rest:path("/testjquery") %rest:GET *function* *jq:test*() *as **node*(){
*let **$html* := <html *xmlns*=*"http://www.w3.org/1999/xhtml%22*%3E <head> <title>Testing JQuery</title> <script *src*=*"http://code.jquery.com/jquery-latest.js%22* *type*=* "text/javascript"*></script> </head> <body> <div> <p><input *id*=*"helpful-yes4"* *name*=*"helpful"* *type*=*"radio"*
</input><span>Yes</span>
<input *id*=*"helpful-no4"* *name*=*"helpful"* *type*=*"radio"*
</input><span>No</span></p>
<p>Here is a paragraph</p> <div *id*=*"t1"*>Test redirectire.</div> <script *type*=*"text/javascript"*>
$("#helpful-no4").click(function ( event ) { $("#t1").show();});
$("#helpful-yes4").click(function ( event ) { $("#t1").hide();});
</script> </div> </body> </html>
*return **$html* };
I access content with: http://localhost:8984/restxq/testjquery
The jquery does not work. If I save the result with a right-click in the browser, it saves as .xml. Jquery doesn't work either. If I rename the saved file .html. It works. Is there anything I can do for the browser to think what it gets is .html when displaying dynamic content?
Note: My html is not as simple as the one above. It is generated from an .xsl that actually says <xsl:output method="html"/>. The result however is the same.
On 05.11.2012, at 22:26, France Baril wrote:
Hi,
I am displaying html from transformed content.
module namespace jq = "http://www.architextus.com/xquery/library/how2_jquery"; declare namespace rest="http://exquery.org/ns/restxq";
declare %rest:path("/testjquery") %rest:GET function jq:test() as node(){
let $html := <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Testing JQuery</title> <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script> </head> <body> <div> <p><input id="helpful-yes4" name="helpful" type="radio"></input><span>Yes</span> <input id="helpful-no4" name="helpful" type="radio"></input><span>No</span></p> <p>Here is a paragraph</p> <div id="t1">Test redirectire.</div> <script type="text/javascript">
$("#helpful-no4").click(function ( event ) { $("#t1").show();}); $("#helpful-yes4").click(function ( event ) { $("#t1").hide();});
</script> </div> </body>
</html>
return $html };
I access content with: http://localhost:8984/restxq/testjquery
The jquery does not work. If I save the result with a right-click in the browser, it saves as .xml. Jquery doesn't work either. If I rename the saved file .html. It works. Is there anything I can do for the browser to think what it gets is .html when displaying dynamic content?
Note: My html is not as simple as the one above. It is generated from an .xsl that actually says <xsl:output method="html"/>. The result however is the same.
Hi France,
can you post your Request/Response Headers? Have tried playing with things, like %output:method("html") as described in [1].
Thanks, Alex
Yes! Noted, declaring xsl:output in the .xsl transform that creates the $html doesn't make it go through the .xqm layer.
It all works now and it will help with another similar issue I've been carrying around.
Big thanks!
France
On Mon, Nov 5, 2012 at 4:39 PM, Alexander Holupirek < alexander.holupirek@uni-konstanz.de> wrote:
On 05.11.2012, at 22:26, France Baril wrote:
Hi,
I am displaying html from transformed content.
module namespace jq = "
http://www.architextus.com/xquery/library/how2_jquery";
declare namespace rest="http://exquery.org/ns/restxq";
declare %rest:path("/testjquery") %rest:GET function jq:test() as node(){
let $html := <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Testing JQuery</title> <script src="http://code.jquery.com/jquery-latest.js"
type="text/javascript"></script>
</head> <body> <div> <p><input id="helpful-yes4" name="helpful"
type="radio"></input><span>Yes</span>
<input id="helpful-no4" name="helpful"
type="radio"></input><span>No</span></p>
<p>Here is a paragraph</p> <div id="t1">Test redirectire.</div> <script type="text/javascript"> $("#helpful-no4").click(function ( event ) { $("#t1").show();}); $("#helpful-yes4").click(function ( event ) { $("#t1").hide();});
</script> </div> </body>
</html>
return $html };
I access content with: http://localhost:8984/restxq/testjquery
The jquery does not work. If I save the result with a right-click in the
browser, it saves as .xml. Jquery doesn't work either.
If I rename the saved file .html. It works. Is there anything I can do
for the browser to think what it gets is .html when displaying dynamic content?
Note: My html is not as simple as the one above. It is generated from an
.xsl that actually says <xsl:output method="html"/>. The result however is the same.
Hi France,
can you post your Request/Response Headers? Have tried playing with things, like %output:method("html") as described in [1].
Thanks, Alex
basex-talk@mailman.uni-konstanz.de