472,791 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 software developers and data experts.

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_client = "pub-5065036055322567";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = "0000FF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "0000FF";
google_color_text = "000000";
//-->
]]>
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

Resulting HTML code is:

<script type="text/javascript">
&lt;!--
google_ad_client = "pub-5065036055322567";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = "0000FF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "0000FF";
google_color_text = "000000";
//--&gt;
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.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="description">
<xsl:attribute name="content">
<xsl:value-of select="definition"/>
</xsl:attribute>
</meta>
</meta>
XSL:
<meta name="description">
<xsl:attribute name="content">
<xsl:value-of select="definition"/>
</xsl:attribute>
</meta>
Results in HTML:
<meta name="description" content="&#xA; the &lt;a
href=&quot;../Activities.html&quot;&gt;activity&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.html&quot;&gt;requirements&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;endeavor&#xA;
&lt;/a&gt;"/>

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

Jul 20 '05 #1
2 10434
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_client = "pub-5065036055322567";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = "0000FF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "0000FF";
google_color_text = "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_client = "pub-5065036055322567";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = "0000FF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "0000FF";
google_color_text = "000000";
]]>
</script>
Resulting HTML code is:
How do I fix this?
specify the 'cdata-section-elements' attribute:
<xsl:output cdata-section-elements="script"/>

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
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...
4
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...
2
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...
3
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...
6
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...
0
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 ...
3
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...
1
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 ...
17
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
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.