RE: [xsl] XSL:if condition shows runtime error................

Subject: RE: [xsl] XSL:if condition shows runtime error................
From: Preethi Suthakar <pree_73@xxxxxxxxx>
Date: Tue, 27 Mar 2001 07:15:24 -0800 (PST)
Hi,

Thanks for all your help, but Iam still stuck with the
same. I tried the same without using any COM objects,
that is with straight forward XML. I have a XML file,
XSL file & a display file which basically displays my
XML indide the div named customer.

I shall cut & paste my code as it is.
 
My XML file(TestDate.asp):

<%	
Response.ContentType = "text/xml"


	'<?xml version='1.0' ?>
	%>


<customers>
	
	<customer>
		
		
		<dateofbirth>12:00:00AM</dateofbirth>
		
				
	</customer>
	
</customers>


MY XSL FILE(xslTestDate.xsl):


<!-- <?xml version='1.0'?> -->
<xsl:stylesheet language="JScript"
xmlns:xsl="http://www.w3.org/TR/WD-xsl";>

  <xsl:template match="/">
    <HTML>
       <BODY>
		  <TABLE border="2" style="CURSOR: HAND;"> 
		  <thead>
		  <TR>
			
            <TH>dateofbirth</TH>
                                                 
          </TR>
          </thead>
           <xsl:for-each select="customers/customer">
         
          <TR>
			<TD>
			<xsl:choose>
				<xsl:when test="dateofbirth='12:00:00AM'">
				<xsl:text
disable-output-escaping="yes">&nbsp;</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="dateofbirth"/>
				</xsl:otherwise>
			</xsl:choose>
				
				</TD>
				</TR>		         
          </xsl:for-each>
        </TABLE>
      </BODY>
    </HTML>
    
  
 </xsl:template> 
</xsl:stylesheet>



MY DISPLAY FILE ("Display.asp"):

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual
Studio 6.0">
<script>

	function window_onload() 
	{
	// Load XML.
	var source = new ActiveXObject("Msxml2.DOMDocument");
	source.async = false;
	source.load("TestDate.asp");
	alert(source.xml)
	
	// Load style sheet.
	var stylesheet = new
ActiveXObject("Msxml2.DOMDocument");
	stylesheet.async = false;
	stylesheet.load("xslTestDate.xsl");
	
	// Displaying the XML within the div named customer
	customer.innerHTML =
source.transformNode(stylesheet);
	}
	
			
</script>
	


</SCRIPT>
</HEAD>
<BODY LANGUAGE=javascript onload="return
window_onload()">

<div id=customer>
</div>

</BODY>
</HTML>



In the code above, I have used xsl:choose suggested by
Purnima. Thanks to her. I even tried the same with
xsl:if.... but it says the same error, which is

Run time error
"Error: Expected token 'eof' found '='
dateofbirth-->=<--'12:00:00AM'


Well, I tried the same with just 12 and without quotes
etc.... but no use.

I would really appreciate someone helping me in this.
Thanks a lot.

Preethi


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread