473,748 Members | 2,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSL <> converted into &lt; and &gt; in final HTML

I am having trouble having Google Adsense code stored in XSL converted
properly into HTML. The <> unfortunately become &lt; and &gt; and then
no longer work.

XSL code is:

<script type="text/javascript">
<![CDATA[
<!--
google_ad_clien t = "pub-506503605532256 7";
google_ad_width = 728;
google_ad_heigh t = 90;
google_ad_forma t = "728x90_as" ;
google_ad_chann el ="";
google_page_url = document.locati on;
google_color_bo rder = "0000FF";
google_color_bg = "FFFFFF";
google_color_li nk = "0000FF";
google_color_ur l = "0000FF";
google_color_te xt = "000000";
//-->
]]>
</script>
<script type="text/javascript"
src="http://pagead2.googles yndication.com/pagead/show_ads.js">
</script>

Resulting HTML code is:

<script type="text/javascript">
&lt;!--
google_ad_clien t = "pub-506503605532256 7";
google_ad_width = 728;
google_ad_heigh t = 90;
google_ad_forma t = "728x90_as" ;
google_ad_chann el ="";
google_page_url = document.locati on;
google_color_bo rder = "0000FF";
google_color_bg = "FFFFFF";
google_color_li nk = "0000FF";
google_color_ur l = "0000FF";
google_color_te xt = "000000";
//--&gt;
</script>
<script type="text/javascript"
src="http://pagead2.googles yndication.com/pagead/show_ads.js">
</script>

How do I fix this?

I get a similar problem when I try to have an XML description containing
html tags properly included into the meta description:

XML:
<meta name="descripti on">
<xsl:attribut e name="content">
<xsl:value-of select="definit ion"/>
</xsl:attribute>
</meta>
</meta>
XSL:
<meta name="descripti on">
<xsl:attribut e name="content">
<xsl:value-of select="definit ion"/>
</xsl:attribute>
</meta>
Results in HTML:
<meta name="descripti on" content="&#xA; the &lt;a
href=&quot;../Activities.html &quot;&gt;activ ity&lt;/a&gt; consisting of
the cohesive collection of all&#xA; &lt;a
href=&quot;../../Tasks/Tasks.html&quot ;&gt;tasks&lt ;/a&gt; that are
primarily performed to produce the&#xA; &lt;a
href=&quot;../../../WorkProducts/RequirementsSet/Requirements/Requirements.ht ml&quot;&gt;req uirements&lt;/a&gt;
and other&#xA; &lt;a
href=&quot;../../../WorkProducts/RequirementsSet/RequirementsSet .html&quot;&gt; requirements
work products&lt;/a&gt; for an&#xA; &lt;a
href=&quot;../../../Endeavors/Endeavors.html& quot;&gt;endeav or&#xA;
&lt;/a&gt;"/>

How do I fix this so that it is properly included?

Jul 20 '05 #1
2 10564
Hi,
I am having trouble having Google Adsense code stored in XSL converted
properly into HTML. The <> unfortunately become &lt; and &gt; and then
no longer work.
What you are looking for is a way to disable output escaping.
XSL code is:

<script type="text/javascript">
<![CDATA[
<!--
google_ad_clien t = "pub-506503605532256 7";
google_ad_width = 728;
google_ad_heigh t = 90;
google_ad_forma t = "728x90_as" ;
google_ad_chann el ="";
google_page_url = document.locati on;
google_color_bo rder = "0000FF";
google_color_bg = "FFFFFF";
google_color_li nk = "0000FF";
google_color_ur l = "0000FF";
google_color_te xt = "000000";
//-->
]]>
</script>
From a (X)HTML point of view, I think this is a better (only valid?) way to include scripts in a document:
<script type="text/javascript">
<![CDATA[
google_ad_clien t = "pub-506503605532256 7";
google_ad_width = 728;
google_ad_heigh t = 90;
google_ad_forma t = "728x90_as" ;
google_ad_chann el ="";
google_page_url = document.locati on;
google_color_bo rder = "0000FF";
google_color_bg = "FFFFFF";
google_color_li nk = "0000FF";
google_color_ur l = "0000FF";
google_color_te xt = "000000";
]]>
</script>
Resulting HTML code is:
How do I fix this?
specify the 'cdata-section-elements' attribute:
<xsl:output cdata-section-elements="scrip t"/>

I get a similar problem when I try to have an XML description containing
html tags properly included into the meta description:

Extract from the XSLT1.0 recommendation:
"It is an error for output escaping to be disabled for a text node that is used for something other than a text node in the result tree."
In this case, you try disbaling output escaping on an attribute. It is not possible with XSLT1.0
How do I fix this so that it is properly included?

AFAIK, the output returned is the only valid way to use '<' and '>' in attributes, so there isn't anything to 'fix'.
regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Spread the wiki (http://www.wikipedia.org)
Jul 20 '05 #2
Donald Firesmith wrote:
I am having trouble having Google Adsense code stored in XSL converted
properly into HTML. The <> unfortunately become &lt; and &gt; and then
no longer work.


http://www.ucc.ie/xml/#usecdata

///Peter
--
"The cat in the box is both a wave and a particle"
-- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
Jul 20 '05 #3

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

Similar topics

12
9472
by: Sammy | last post by:
Hi, my mind is going crazy. I have tried everything I can think of to no avail. I have tried Disable Output Escaping. I tried to think of a way of enclosing the attribute data in a CDATA element. That did not parse. Here is my question: How can I get attribute values to not get converted from &apos; to '
4
62111
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I supposed to write this function? String.replace(/</g,'&lt;');
2
22952
by: Francesco Moi | last post by:
Hello. I designed a form to edit some DataBase's fields. But some of these fields contain '&lt;' and '&gt;' characters. And these characters are '<' and '>' in HTML. So if want to edit these fields, the form converts them into '<' and '>'. And I want to mantain '&lt;' and '&gt;' Mi piece of code:
3
2560
by: shaun roe | last post by:
a follow up with new problems from my previous post: I have xml encoded in a string with elements like &lt;myElement/&gt; e.g <codeFragment> &lt;myElement&gt;some text&lt;/myElement&gt; </codeFragment> I parse this in Xerces and I can see it has done the correct thing,
6
24353
by: tentstitcher | last post by:
Hi all: I have a source xml document with an element of type string. This element contains something like the following: <stringData> &lt;Header&gt; &lt;Body&gt; </stringData> I would like to apply an XSLT and replace all occurances of &lt; with < and &gt; with >.
0
1875
by: JimL | last post by:
If you have problems with ASP.NET AJAX not working as expected, check that the expected script is being rendered in the final HTML. If not, and in general ensure that you do *not* have tag <xhtmlConformance mode="Legacy"/> in your web.config file cheers Jim
3
4018
by: webmasterATflymagnetic.com | last post by:
Folks, I'm struggling to put the question together, but I have this problem. I have written an HTML form that I can use for data entry. This uses PHP to write a SQL UPDATE command that gets written to my MySQL database. I can later view this data back in the form. One thing I've noticed happening is if I enter code such as &lt; it gets rewritten as < (ie the less-than sign). Now I don't want this to happen, but something somewhere is...
1
5494
by: VaidehiPawar | last post by:
I am a beginner level in xml..my output page does not convert &gt &lt it shows something like this " &lt;b&gt;Location.&lt;/b&gt;&lt;br /&gt; &lt;UL&gt;&lt;LI&gt;Park Central New York " can anyone help? here is my code <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/">
17
4301
by: Kaushal Elsner | last post by:
<contact_us_client_email> <message> &lt;!]&gt; </message> <header> <!]>From: support@blurbpoint.com </header> </contact_us_client_email>
0
8823
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9530
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
9363
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
8237
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...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
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
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.