Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't type url src ampersand in XSP Editor

Tags:

xml

xpages

The xPage XSP editor does not allow me to type & in the src url

<xp:script src="http://maps.googleapis.com/maps/api/js?key=1234&test=1" />

or

<script src="http://maps.googleapis.com/maps/api/js?key=1234&test=1" />

I can ofcourse change the url to &amp; but then google does not accept the url

any ideas?

src?

like image 542
Thomas Adrian Avatar asked Nov 23 '25 23:11

Thomas Adrian


2 Answers

The xPage XSP editor does not allow me to type & in the src url

& means "Start of character reference". If you want to include one as data you must use the character reference for it: &amp;.

I can of course change the url to &amp; but then google does not accept the url

The XML parser must decode it back to & when it converts from XML to a data structure. By the time it gets to Google, it shouldn't be &amp; any more.

like image 198
Quentin Avatar answered Nov 25 '25 15:11

Quentin


don't use script, use xp:scriptBlock for output scripts, like this:

<xp:scriptBlock>
    <xp:this.src><![CDATA[
        http://maps.googleapis.com/maps/api/js?key=1234&test=1
    ]]></xp:this.src>
</xp:scriptBlock>

Hope that helps.

like image 42
Jeremy Hodge Avatar answered Nov 25 '25 15:11

Jeremy Hodge