473,395 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

&lt &gt Problem...Ignoring specific characters like > in the XML

I am a beginner level in xml..my output page does not convert &gt &lt it shows something like this
" <b>Location.</b><br /> <UL><LI>Park Central New York " can anyone help?
here is my code
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2.  
  3. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4.  
  5. <xsl:template match="/">
  6.  
  7.     <html>
  8.     <head>
  9.         <style>
  10.  
  11.             body
  12.                 {
  13.                 font-family: Arial, Helvetica, sans-serif;
  14.                 font-size: 12px;
  15.                 font-style: normal;
  16.                 font-weight: normal;
  17.                 text-decoration: none;            
  18.                 }
  19.  
  20.  
  21.         </style>
  22.         <script language="javascript" type="text/javascript">
  23.  
  24.         /*            
  25.          This is the function which toggles the display of required blocks 
  26.         */
  27.  
  28.         function showHide(hotelId)
  29.         {
  30.             items=document.getElementsByName("hotelDtl");
  31.             // alert(items.length) 
  32.             for(var i = 0 ; i &lt; items.length ; i++)
  33.             {    
  34.                 items[i].style.display ="none";
  35.             }                
  36.             document.getElementById("td_"+hotelId).style.display ="";
  37.  
  38.         }
  39.  
  40.         /*            
  41.          This is the function which hides all the main blocks containing hotel information on page load
  42.         */
  43.  
  44.         function hideAll()
  45.         {
  46.             items=document.getElementsByName("hotelDtl");
  47.  
  48.              for(var i = 0 ; i &lt; items.length ; i++){
  49.                 items[i].style.display ="none";
  50.              }    
  51.         }
  52.  
  53.         </script>
  54.     </head>
  55.       <body onload="hideAll();"> 
  56.  
  57.  
  58.  
  59. <table width="70%" border="0" align="center" cellpadding="3" cellspacing="1">
  60.   <tr>
  61.     <td align="center"><b>Assignment for XSLT with ASP for rendering the XML file </b></td>
  62.   </tr>
  63.   <tr>
  64.     <td></td>
  65.   </tr>
  66.   <tr>
  67.     <td>
  68.  
  69.             <table width="80%" border="0" align="center" cellpadding="3" cellspacing="1">
  70.               <tr>
  71.                 <td width="20%">Choose Hotel : </td>
  72.                 <td>
  73.                        <!-- Populate the hotel names in a select box 
  74.                        OnChange event of this, there is a call given to a Javascript function
  75.                        This function handles, which block to show and which ones to hide
  76.                        This is achived using the HTML element attributes like name and Id
  77.                        The inbuilt javascript function getElementById is used to select the element which needs to be displayed
  78.                        The inbuilt javascript function getElementsByName is used to select the elements which needs to be hidden
  79.                        -->
  80.                        <select id="hotelName" name="hotelName" onchange="return showHide(this.value);">
  81.                                 <option value="">--Select Hotel--</option>
  82.  
  83.                                 <xsl:for-each select="HotelAvailabilityListResults/Hotel">
  84.                                     <option value="{hotelId}">
  85.                                         <xsl:attribute name="id">
  86.                                                 <xsl:value-of select='hotelId'/>                                    
  87.  
  88.                                         </xsl:attribute>
  89.                                              <xsl:value-of select="name"/>     
  90.  
  91.                                     </option>
  92.                                 </xsl:for-each>
  93.                         </select>
  94.                 </td>
  95.               </tr>
  96.             </table>    
  97.     </td>
  98.   </tr>
  99.   <tr>
  100.     <td height="10"></td>
  101.   </tr>
  102.   <tr>
  103.     <td>
  104.             <table width="80%" border="0" align="center" cellpadding="3" cellspacing="1">
  105.                 <tr>
  106.                   <td>The information of the hotel chosen is shownhere : </td>
  107.                 </tr>
  108.             </table>
  109.       </td>
  110.   </tr>
  111.   <tr>
  112.     <td height="10"></td>
  113.   </tr>
  114.   <tr>
  115.     <td>
  116.                     <table cellpadding="3" cellspacing="1" border="0" width="100%">
  117.                               <xsl:for-each select="HotelAvailabilityListResults/Hotel">
  118.                                 <tr name="hotelDtl" style="display:none">
  119.                                     <xsl:attribute name="id">
  120.                                     <xsl:text>td_</xsl:text>
  121.                                             <xsl:value-of select='hotelId'/>
  122.                                     </xsl:attribute>                        
  123.                                           <td>                                            
  124.  
  125.                                                     <table width="80%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
  126.                                                                   <tr>
  127.                                                                     <td width="40%" align="left" valign="top" bgcolor="#FFFFFF">Hotel Name </td>
  128.                                                                     <td align="left" valign="top" bgcolor="#FFFFFF"><xsl:value-of select='name'/></td>
  129.                                                                   </tr>
  130.                                                                   <tr>
  131.                                                                     <td align="left" valign="top" bgcolor="#FFFFFF">Address</td>
  132.                                                                     <td align="left" valign="top" bgcolor="#FFFFFF">
  133.                                                                         <xsl:value-of select="address1"/> 
  134.                                                                         <br />
  135.                                                                         <xsl:value-of select="address2"/>
  136.                                                                         <br />
  137.                                                                         <xsl:value-of select="address3"/>
  138.                                                                         <br />                                                                        
  139.                                                                         <xsl:value-of select="city"/> - <xsl:value-of select="10019"/>
  140.                                                                         <br />
  141.                                                                         <xsl:value-of select="stateProvince"/>
  142.                                                                         <br />
  143.                                                                         <xsl:value-of select="country"/>
  144.                                                                         <br />
  145.                                                                     </td>
  146.                                                                   </tr>
  147.                                                                   <tr>
  148.                                                                     <td align="left" valign="top" bgcolor="#FFFFFF">Description</td>
  149.                                                                     <td align="left" valign="top" bgcolor="#FFFFFF">
  150.                                                                         <xsl:value-of select="shortDescription" disable-output-escaping="no"/>
  151.                                                                     </td>
  152.                                                                   </tr>
  153.                                                                   <tr>
  154.                                                                     <td align="left" valign="top" bgcolor="#FFFFFF">Rate Information </td>
  155.                                                                     <td align="left" valign="top" bgcolor="#FFFFFF">
  156.                                                                             <table border="0" align="left" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
  157.                                                                               <tr>
  158.                                                                                 <td bgcolor="#FFFFFF">Low</td>
  159.                                                                                 <td bgcolor="#FFFFFF">$ <xsl:value-of select="lowRate"/> </td>
  160.                                                                               </tr>
  161.  
  162.                                                                               <tr>
  163.                                                                                 <td bgcolor="#FFFFFF">High</td>
  164.                                                                                 <td bgcolor="#FFFFFF">$ <xsl:value-of select="highRate"/></td>
  165.                                                                               </tr>
  166.                                                                             </table>
  167.                                                                     </td>
  168.                                                                   </tr>                                                                 
  169.                                                     </table>
  170.  
  171.  
  172.                                           </td>                                 
  173.                                 </tr>                    
  174.                               </xsl:for-each>
  175.                     </table>
  176.  
  177.  
  178.  
  179.  
  180.  
  181.     </td>
  182.   </tr>    
  183.  
  184.   <tr>
  185.     <td align="center"> </td>
  186.   </tr>  
  187. </table>    
  188.   </body>
  189.   </html>
  190. </xsl:template>
  191. </xsl:stylesheet>
  192.  
  193.  
Jul 31 '10 #1
1 5450
jkmyoung
2,057 Expert 2GB
Without the source, I'm not sure what you're specifically looking at, but trying using the disable-output-escaping attribute with element <xsl:value-of>.
Aug 4 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: wenke | last post by:
Hi, I am using the following code (see below) from php.net (http://www.php.net/manual/en/ref.xml.php, example 1) to parse an XML file (encoded in UTF-8). I changed the code slightly so that the...
2
by: Donald Firesmith | last post by:
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...
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...
1
by: RJN | last post by:
Hi I'm using XMLTextReader to parse the contents of XML. I have issues when the xml content itself has some special characters like & ,> etc. <CompanyName>Johnson & Jhonson</CompanyName>...
2
by: andrew007 | last post by:
I do xml / xslt transformation using asp.net but I found any value (w/xml format) in xml node html-encoded to &lt and &gt format if it's > or < tag. Since I have sub xml data in a parent xml node...
1
by: RJN | last post by:
Hi I'm using XMLTextReader to parse the contents of XML. I have issues when the xml content itself has some special characters like & ,> etc. <CompanyName>Johnson & Jhonson</CompanyName>...
1
by: Robert Dodier | last post by:
Hello, Sorry for asking what must be a FAQ, but I wasn't able to find the answer. I have an XML document fragment which I want to store as a text string. I want a function to convert any XML...
4
by: mark4asp | last post by:
I have an element, report which contains tags which have been transformed. E.g. <pis &lt;p&gt <myXml> <report>This text has html tags in it.&lt;p&gt which but <has been changed to &lt;&gt</report>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.