admin管理员组文章数量:1023025
I am using CDATA to escape the script but in IE8's debugger I still get this message: "Expected ')'" in the for loop conditions. I am assuming it still thinks that the ; in the <
generated by CDATA is ending the loop conditions.
Original script in my XSL template:
<script type="text/javascript" language="javascript">
<![CDATA[
function submitform(form){
var oErrorArray = new Array();
for (i=0;i<form.length;i++)
eval("oErrorArray["+i+"]=oError"+i);
var goForm = true;
for(i=0;i<form.length;i++) {
oErrorArray[i].innerHTML = "";
if(form[i].value="")){
oErrorArray[i].innerHTML = "Error - input field is blank";
goForm = false;
}
}
if(goForm == true) form.submit();
}
function resetform(form){
form.reset();
}
]]>
</script>
Code generated after transformation (from IE8 debugger):
<script type="text/javascript" language="javascript">
function submitform(form){
var oErrorArray = new Array();
for (i=0;i<form.length;i++)
eval("oErrorArray["+i+"]=oError"+i);
goForm = true;
for(i=0;i<form.length;i++) {
oErrorArray[i].innerHTML = "";
if(form[i].value="")){
oErrorArray[i].innerHTML = "Error - input field is blank";
goForm = false;
}
}
if(goForm == true) form.submit();
}
function resetform(form){
form.reset();
}
</script>
Error reported by IE8 debugger: Expected ')' login.xml, line 29 character 30 (which is right after the first "form.length")
I am using CDATA to escape the script but in IE8's debugger I still get this message: "Expected ')'" in the for loop conditions. I am assuming it still thinks that the ; in the <
generated by CDATA is ending the loop conditions.
Original script in my XSL template:
<script type="text/javascript" language="javascript">
<![CDATA[
function submitform(form){
var oErrorArray = new Array();
for (i=0;i<form.length;i++)
eval("oErrorArray["+i+"]=oError"+i);
var goForm = true;
for(i=0;i<form.length;i++) {
oErrorArray[i].innerHTML = "";
if(form[i].value="")){
oErrorArray[i].innerHTML = "Error - input field is blank";
goForm = false;
}
}
if(goForm == true) form.submit();
}
function resetform(form){
form.reset();
}
]]>
</script>
Code generated after transformation (from IE8 debugger):
<script type="text/javascript" language="javascript">
function submitform(form){
var oErrorArray = new Array();
for (i=0;i<form.length;i++)
eval("oErrorArray["+i+"]=oError"+i);
goForm = true;
for(i=0;i<form.length;i++) {
oErrorArray[i].innerHTML = "";
if(form[i].value="")){
oErrorArray[i].innerHTML = "Error - input field is blank";
goForm = false;
}
}
if(goForm == true) form.submit();
}
function resetform(form){
form.reset();
}
</script>
Error reported by IE8 debugger: Expected ')' login.xml, line 29 character 30 (which is right after the first "form.length")
Share Improve this question asked Jun 14, 2010 at 5:09 KyleKyle 631 silver badge7 bronze badges 1- possible duplicate of xslt, javascript and unescaped html entities – Kobi Commented Jun 14, 2010 at 5:31
1 Answer
Reset to default 3You need to disable output escaping explicitly.
http://www.w3/TR/xslt#disable-output-escaping
As Kyle note in the ments, in particular you need to
(1) remove the CDATA tags and
(2) insert <xsl:text disable-output-escaping="yes"><</xsl:text>
where you need the character not to be escaped.
I am using CDATA to escape the script but in IE8's debugger I still get this message: "Expected ')'" in the for loop conditions. I am assuming it still thinks that the ; in the <
generated by CDATA is ending the loop conditions.
Original script in my XSL template:
<script type="text/javascript" language="javascript">
<![CDATA[
function submitform(form){
var oErrorArray = new Array();
for (i=0;i<form.length;i++)
eval("oErrorArray["+i+"]=oError"+i);
var goForm = true;
for(i=0;i<form.length;i++) {
oErrorArray[i].innerHTML = "";
if(form[i].value="")){
oErrorArray[i].innerHTML = "Error - input field is blank";
goForm = false;
}
}
if(goForm == true) form.submit();
}
function resetform(form){
form.reset();
}
]]>
</script>
Code generated after transformation (from IE8 debugger):
<script type="text/javascript" language="javascript">
function submitform(form){
var oErrorArray = new Array();
for (i=0;i<form.length;i++)
eval("oErrorArray["+i+"]=oError"+i);
goForm = true;
for(i=0;i<form.length;i++) {
oErrorArray[i].innerHTML = "";
if(form[i].value="")){
oErrorArray[i].innerHTML = "Error - input field is blank";
goForm = false;
}
}
if(goForm == true) form.submit();
}
function resetform(form){
form.reset();
}
</script>
Error reported by IE8 debugger: Expected ')' login.xml, line 29 character 30 (which is right after the first "form.length")
I am using CDATA to escape the script but in IE8's debugger I still get this message: "Expected ')'" in the for loop conditions. I am assuming it still thinks that the ; in the <
generated by CDATA is ending the loop conditions.
Original script in my XSL template:
<script type="text/javascript" language="javascript">
<![CDATA[
function submitform(form){
var oErrorArray = new Array();
for (i=0;i<form.length;i++)
eval("oErrorArray["+i+"]=oError"+i);
var goForm = true;
for(i=0;i<form.length;i++) {
oErrorArray[i].innerHTML = "";
if(form[i].value="")){
oErrorArray[i].innerHTML = "Error - input field is blank";
goForm = false;
}
}
if(goForm == true) form.submit();
}
function resetform(form){
form.reset();
}
]]>
</script>
Code generated after transformation (from IE8 debugger):
<script type="text/javascript" language="javascript">
function submitform(form){
var oErrorArray = new Array();
for (i=0;i<form.length;i++)
eval("oErrorArray["+i+"]=oError"+i);
goForm = true;
for(i=0;i<form.length;i++) {
oErrorArray[i].innerHTML = "";
if(form[i].value="")){
oErrorArray[i].innerHTML = "Error - input field is blank";
goForm = false;
}
}
if(goForm == true) form.submit();
}
function resetform(form){
form.reset();
}
</script>
Error reported by IE8 debugger: Expected ')' login.xml, line 29 character 30 (which is right after the first "form.length")
Share Improve this question asked Jun 14, 2010 at 5:09 KyleKyle 631 silver badge7 bronze badges 1- possible duplicate of xslt, javascript and unescaped html entities – Kobi Commented Jun 14, 2010 at 5:31
1 Answer
Reset to default 3You need to disable output escaping explicitly.
http://www.w3/TR/xslt#disable-output-escaping
As Kyle note in the ments, in particular you need to
(1) remove the CDATA tags and
(2) insert <xsl:text disable-output-escaping="yes"><</xsl:text>
where you need the character not to be escaped.
本文标签: xmlHow do I get a less than in a javascript for loop in XSL to workStack Overflow
版权声明:本文标题:xml - How do I get a less than in a javascript for loop in XSL to work? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745595007a2158112.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论