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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • VaidehiPawar
    New Member
    • Jul 2010
    • 1

    #1

    &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>Locati on.</b><br /> <UL><L I>Park Central New York " can anyone help?
    here is my code
    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="/">
    
    	<html>
    	<head>
    		<style>
    
    			body
    				{
    				font-family: Arial, Helvetica, sans-serif;
    				font-size: 12px;
    				font-style: normal;
    				font-weight: normal;
    				text-decoration: none;			
    				}
    		
    
    		</style>
    		<script language="javascript" type="text/javascript">
    		
    		/*			
    		 This is the function which toggles the display of required blocks 
    		*/
    
    		function showHide(hotelId)
    		{
    			items=document.getElementsByName("hotelDtl");
    			// alert(items.length) 
    			for(var i = 0 ; i &lt; items.length ; i++)
    			{	
    				items[i].style.display ="none";
    			}				
    			document.getElementById("td_"+hotelId).style.display ="";
    			
    		}
    
    		/*			
    		 This is the function which hides all the main blocks containing hotel information on page load
    		*/
    		
    		function hideAll()
    		{
    			items=document.getElementsByName("hotelDtl");
    			
    			 for(var i = 0 ; i &lt; items.length ; i++){
    				items[i].style.display ="none";
    			 }	
    		}
    		
    		</script>
    	</head>
    	  <body onload="hideAll();"> 
    	
    
    
    <table width="70%" border="0" align="center" cellpadding="3" cellspacing="1">
      <tr>
        <td align="center"><b>Assignment for XSLT with ASP for rendering the XML file </b></td>
      </tr>
      <tr>
        <td></td>
      </tr>
      <tr>
        <td>
    	
    			<table width="80%" border="0" align="center" cellpadding="3" cellspacing="1">
    			  <tr>
    				<td width="20%">Choose Hotel : </td>
    				<td>
    					   <!-- Populate the hotel names in a select box 
    					   OnChange event of this, there is a call given to a Javascript function
    					   This function handles, which block to show and which ones to hide
    					   This is achived using the HTML element attributes like name and Id
    					   The inbuilt javascript function getElementById is used to select the element which needs to be displayed
    					   The inbuilt javascript function getElementsByName is used to select the elements which needs to be hidden
    					   -->
    					   <select id="hotelName" name="hotelName" onchange="return showHide(this.value);">
    								<option value="">--Select Hotel--</option>
    							    
    							    <xsl:for-each select="HotelAvailabilityListResults/Hotel">
    									<option value="{hotelId}">
    										<xsl:attribute name="id">
    												<xsl:value-of select='hotelId'/>									
    																																				
    										</xsl:attribute>
    											 <xsl:value-of select="name"/> 	
    									
    									</option>
    							    </xsl:for-each>
    					    </select>
    				</td>
    			  </tr>
    			</table>	
    	</td>
      </tr>
      <tr>
        <td height="10"></td>
      </tr>
      <tr>
        <td>
    			<table width="80%" border="0" align="center" cellpadding="3" cellspacing="1">
    				<tr>
    				  <td>The information of the hotel chosen is shownhere : </td>
    				</tr>
    			</table>
    	  </td>
      </tr>
      <tr>
        <td height="10"></td>
      </tr>
      <tr>
        <td>
    					<table cellpadding="3" cellspacing="1" border="0" width="100%">
    							  <xsl:for-each select="HotelAvailabilityListResults/Hotel">
    								<tr name="hotelDtl" style="display:none">
    									<xsl:attribute name="id">
    									<xsl:text>td_</xsl:text>
    											<xsl:value-of select='hotelId'/>
    									</xsl:attribute>						
    										  <td>											
    											
    													<table width="80%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
    																  <tr>
    																	<td width="40%" align="left" valign="top" bgcolor="#FFFFFF">Hotel Name </td>
    																	<td align="left" valign="top" bgcolor="#FFFFFF"><xsl:value-of select='name'/></td>
    																  </tr>
    																  <tr>
    																	<td align="left" valign="top" bgcolor="#FFFFFF">Address</td>
    																	<td align="left" valign="top" bgcolor="#FFFFFF">
    																		<xsl:value-of select="address1"/> 
    																		<br />
    																		<xsl:value-of select="address2"/>
    																		<br />
    																		<xsl:value-of select="address3"/>
    																		<br />																		
    																		<xsl:value-of select="city"/> - <xsl:value-of select="10019"/>
    																		<br />
    																		<xsl:value-of select="stateProvince"/>
    																		<br />
    																		<xsl:value-of select="country"/>
    																		<br />
    																	</td>
    																  </tr>
    																  <tr>
    																	<td align="left" valign="top" bgcolor="#FFFFFF">Description</td>
    																	<td align="left" valign="top" bgcolor="#FFFFFF">
    																		<xsl:value-of select="shortDescription" disable-output-escaping="no"/>
    																	</td>
    																  </tr>
    																  <tr>
    																	<td align="left" valign="top" bgcolor="#FFFFFF">Rate Information </td>
    																	<td align="left" valign="top" bgcolor="#FFFFFF">
    																			<table border="0" align="left" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
    																			  <tr>
    																				<td bgcolor="#FFFFFF">Low</td>
    																				<td bgcolor="#FFFFFF">$ <xsl:value-of select="lowRate"/> </td>
    																			  </tr>
    																			  
    																			  <tr>
    																				<td bgcolor="#FFFFFF">High</td>
    																				<td bgcolor="#FFFFFF">$ <xsl:value-of select="highRate"/></td>
    																			  </tr>
    																			</table>
    																	</td>
    																  </tr>																 
    													</table>
    												
    												
    										  </td>								 
    								</tr>					
    							  </xsl:for-each>
    					</table>
    
    	
    	
    			
    			
    	</td>
      </tr>	
    		
      <tr>
        <td align="center"> </td>
      </tr>  
    </table>	
      </body>
      </html>
    </xsl:template>
    </xsl:stylesheet>
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    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>.

    Comment

    Working...