473,591 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generating http requests in XML/XSLT

Hi, I'm looking at using XML and XSLT with apache cocoon to
automatically generate html files for a site. the problem I'm having
is that I want one of the pages to display a google map, but the google
API requires the following line in the output HTML:

<script src="http://maps.google.com/maps?file=api&v =2&key=abcdefg "
type="text/javascript">

The problem is that I can't get the '&' to properly make it into the
result. I can get &amp;. Is there any way to force the XSLT to output
a naked '&' into the link? Should I use some alternative construction?

I've tried using a variable:
<xsl:variable name="GoogleAPI ">
<![CDATA[http://maps.google.com/maps?file=api&v =2&key=abcdefg]]>
</xsl:variable>
<script src="$GoogleAPI " type="text/javascript">

But this doesn't work.

Any help will be appreciated, thanks.

-Colin

Apr 5 '06 #1
3 2005


cr****@gmail.co m wrote:
I'm looking at using XML and XSLT with apache cocoon to
automatically generate html files for a site. the problem I'm having
is that I want one of the pages to display a google map, but the google
API requires the following line in the output HTML:

<script src="http://maps.google.com/maps?file=api&v =2&key=abcdefg "
type="text/javascript">

The problem is that I can't get the '&' to properly make it into the
result. I can get &amp;. Is there any way to force the XSLT to output
a naked '&' into the link?


I don't think you have force anything, if you generate HTML with XSLT
then the XSLT processor is right to make that src URL

<script src="http://maps.google.com/maps?file=api&a mp;v=2&amp;key= abcdefg"
type="text/javascript"></script>

and any browser then parsing that HTML will make the proper request to
the maps.google.com server. Using &amp; is proper HTML. The HTTP request
the browser makes after parsing that HTML will only contain & instead.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 5 '06 #2
Thanks!

Apr 5 '06 #3
Make sure you have an xsl:output directive in your stylesheet which says
you want to produce HTML output. The XSLT processor should then
recognize that this src attribute is a URI, and format/escape it
according to the standard rules for URIs. The result should be
compatable with any standard HTML-based application.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Apr 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2129
by: Steve Dussinger | last post by:
Hi All: I am attempting to use an XSL stylesheet to take data from an existing DOM document, and place it into a different existing DOM document. The problem I'm having is that I get the following exception from Xalan-J (version 2.5.2), because I am not generating a single root node from my stylesheet: "Can't have more than one root on a DOM!"
4
1972
by: Tristan Miller | last post by:
Greetings. I would like to produce a static multilingual website in XHTML. Is it possible to specify each web page in its own XML file, but have all of the translations encapsulated in that one file, and then process each XML file to generate separate language-variant XHTML files? For example, say we have a file foo.xml which contains, in part, something like the following:
5
4406
by: shauldar | last post by:
Is there a way (tool, hack...) to create an XSL:FO from an XSLT + XML files? My motivation is that we want to use a tool to design reports, and from that "design" generate both HTML (via XSLT) and PDF (via XSL:FO). The only tool we have seen is Altova's StyleVision, which is very unfriendly (and uses a proprietary representation, SPS, from which it generates the various XSLs). We have considered instead using InfoPath, which is WYSIWYG,...
1
1400
by: Andy Fish | last post by:
Hi, In my aspx web application, I am generating a list of items in a menu down the left-hand side. Different items in the list may have different controls in, and this is data-driven at runtime. At the moment I am using a custom template control similar to a repeater but with many different templates. However, It's a bit of a pain to work with and maintain. What I would like to do is generate the list of menu items using XSLT
10
2327
by: Simon Brooke | last post by:
Here's my problem: <xsl:template match="/category"> .... <script type="text/javascript"> &lt;!]&gt; </script> .... </xsl:template>
4
1296
by: shaun roe | last post by:
I have a directory which contains many xml files as a result of some analysis. I would like to have an XSL which loops over all these files and generates a web page indicating some summary information from each one of these files. Is there any way of doing this in XSLT entirely, or am I forced to go to perl/python for this kind of task? I am aware of the "document" command in xsl but cannot see how to pipe it a whole series of files such...
7
8744
by: Dag Sunde | last post by:
I want to use the format-number function to output a number with a specific number of decimals, based on the content of a node... Is there any smart way to generate differnet strings based on a node-value? if decimals = 0, I want "###,###" decimals = 1, I want "###,###.0" decimals = 2, I want "###,###.00" decimals = n, I want "###,###.000..n"
3
2456
by: Andy Dingley | last post by:
>From a thread over in c.i.w.a.h "RFC: From XHTML to HTML via XSLT" http://groups.google.co.uk/group/comp.infosystems.www.authoring.html/msg/f112c230061ffe86 As is well-known, the XSLT HTML output method should generate <br> rather than <br /or <br></br> From: <http://www.w3.org/TR/xslt#section-HTML-Output-Method> : The html output method should not output an end-tag for empty
2
1256
by: orsula | last post by:
Hi all, I would like to generate xml from a structure, e.g.: Dictionary <key, valueArraymyDict; Into : <myDict> <key>key</key> <valueArray> <value>1</value> <value>2</value>
0
7934
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8236
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8362
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8225
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6639
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3850
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1465
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.