Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xml javascript characters

Status
Not open for further replies.

silverfang

Programmer
Aug 30, 2005
3
BE
I wanted to make a for-loop in an xsl stylesheet:
for(i=0;i<100;i++){
...
}
But then I get this : A name contained an invalid character ...

what can I do to help this?
 
Its the < that causes the problem. You can either put the whole thing in cdata tags:
Code:
<script>
<![CDATA[
   for(i=0;i<100;i++){
    ...
   }
]]>
</script>
Or, you can replace the < with &lt;


Jon

"I don't regret this, but I both rue and lament it.
 
I knew the < caused the problem, so I tried to replace it with &lt;. I see you would recommend the same, but it doesn't work

I'm gonna try the other solution
thx
 
Post your full XML, changing it to &lt; will work. The problem must be elsewhere.

Jon

"I don't regret this, but I both rue and lament it.
 
JontyMC is the guru of xml but .....

instead of:

for(i=0; i<100 ;i++){

I would use:

for(i=0; 100>i ;i++){

always solves the problem for me

hth

simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top