less than operartor wont work

W

WStoreyII

everytime that i try to use the less than operator

function ToCurrency(amt)
{
if (amt <= -1)
{
}
}
i get the following error in the browser
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and
then click the Refresh button, or try again later.


----------------------------------------------------------------------------
----

A name was started with an invalid character. Error processing resource
'file:///C:/Documents and Settings/William Storey II/Desktop/test.xsl'. Line
12, Position 11

if (x <= -1)
----------^does anyone have any ideas as to why this happens and how to fix
it thanks wstoreyII
 
L

Lasse Reichstein Nielsen

WStoreyII said:
everytime that i try to use the less than operator ....
if (amt <= -1) ....
i get the following error in the browser
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and
then click the Refresh button, or try again later. ....
A name was started with an invalid character. Error processing resource
'file:///C:/Documents and Settings/William Storey II/Desktop/test.xsl'. Line
12, Position 11

Why is the extension "xsl"?
My guess is that IE uses the extension to decide that the file is an
XSLT transformation. That means that it is an XML file. Inside an XML
file, the "less than" sign means something, and must be escaped.

Shouldn't it be an "html" file?

/L
 
J

Janwillem Borleffs

WStoreyII said:
everytime that i try to use the less than operator

function ToCurrency(amt)
{
if (amt <= -1)
{
}
}
i get the following error in the browser
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error
and then click the Refresh button, or try again later.

In XML, some characters like the less than operator should be translated to
their enitiy. In your case, you should write:

if (amt &lt;= -1)

Alternatively, you can also put the function definition in a CDATA section:

<script type="text/javascript">
<![CDATA[
// JS code
]]>
</script>


JW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top