[MarkLogic Dev General] javascript in .xqy file

Shannon Shiflett at virginia.edu
Wed Aug 27 12:05:26 PDT 2008


Escape the braces by doubling them up, e.g., {{ and }}.  If your JS  
contains a < or > then you'll need to move your function to a  
separate .js file and include it in the XQY, like so: <script  
type="text/javascript" src="javascript/prototype.js"></script>.

On Aug 27, 2008, at 3:01 PM, Mindie Sorenson wrote:

> I have the following script in the  <head> tag of my .xqy page:
>
> <script type="text/javascript">
>       // this should be in the head
>       $(function(){
>             $("#suggest2").autocomplete("test.xqy", {
>             delay: 200,
>             width: 260,
>             selectFirst: false
>         });
>       })
> </script>
>
> However, this code breaks the .xqy page.  I have verified that this  
> code works great in a standard html file, but as soon as I move it  
> to my .xqy page, it causes errors.  I have tried adding extra curly  
> braces in an attempt to escape them, and the page will then render,  
> but the javascript isn’t evaluated correctly.
>
> Does anyone know a ‘trick’ for using javascript like this in .xqy  
> files?
>
> Thanks
> Mindie
>
> 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
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general

__________________________________________________
Shannon Scott Shiflett, programmer/analyst with ROTUNDA,
The University of Virginia Press, Charlottesville, VA  USA
http://rotunda.upress.virginia.edu



More information about the General mailing list