我有一个系统,其中部分 XML 代码通过 XSL 表转换为 HTML。所有的转换都是在 Javascript 中完成的,但在 Chrome(以及其他现代浏览器,如 FF 等)上,我收到了 XML 解析错误。我为相同的 XML 尝试了不同的验证器,没有报告错误,甚至尝试过在线 XSL 转换器 - 没有问题。所以也许我可以从社区获得一些帮助来指出我在这里做错了什么。 (还尝试查看在线 XSLT 是如何做的,他们的代码被混淆到我无法混淆的程度:D)。
请参考代码片段。一个简单的 XML 结构(存储在页面中它自己的元素中并通过 getElementById 检索,对于 XSL 也是如此)。 BODY 注册了一个 onLoad 事件来调用 form_loaded() JS 函数,该函数又调用 create_form()。所以整个 HTML 文件实际上看起来像这样,让我尝试将其放入代码段中(请忽略任何遗留的 HTML/CSS 内容,而不是这里的重点 :D):
<HTML>
<HEAD>
<title>Testing XSLT</title>
</HEAD>
<xml style="display: none;" id="XMLFormData">
<?xml version="1.0" encoding="UTF-8" ?>
<FORM>
<SECTION title="SuperSection" id="0" display="NONE">
<NONRECURSIVE>
<ELEMENT>
<ATTRIBUTE>
<TYPE>
<![CDATA[IFT]]>
</TYPE>
<SUBTYPE>
<![CDATA[]]>
</SUBTYPE>
<NAME>
<![CDATA[DFLTF]]>
</NAME>
<DB_TYPE>
<![CDATA[V]]>
</DB_TYPE>
<FIELD_TEXT>
<![CDATA[]]>
</FIELD_TEXT>
<BOUND_DATA>
<![CDATA[]]>
</BOUND_DATA>
<SIZE>
<![CDATA[]]>
</SIZE>
<TITLE>
<![CDATA[SOME TEXT]]>
</TITLE>
<VALUE>
<![CDATA[]]>
</VALUE>
<EVENTS>
<![CDATA[]]>
</EVENTS>
</ATTRIBUTE>
</ELEMENT>
</NONRECURSIVE>
</SECTION>
</FORM>
</xml>
<xml style="display: none;" id="XSLDefaultForm">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration="yes" standalone="yes" indent="yes" media-type="text/html" />
<xsl:template match="/FORM/SECTION">
<html>
<style>
TD.datagridHeader {
border-Top: "1 solid buttonhighlight";
border-Left: "1 solid buttonhighlight";
border-Right: "1 solid buttonshadow";
border-Bottom: "1 solid buttonshadow";
background-Color: "#C5DEFD";
font-family: "MS Sans Serif";
font-size: "8pt";
padding: "2";
}
TD.datagridField {
border-Top: "1 solid buttonhighlight";
border-Left: "1 solid buttonhighlight";
border-Right: "1 solid buttonshadow";
border-Bottom: "1 solid buttonshadow";
background-color: "#FFFFFF";
font-size: "8pt";
text-align: "RIGHT";
}
FIELDSET.theStyle {
padding: "6";
font-family: "MS Sans Serif";
font-size: "8pt";
width: "1000";
}
TD.emptyTD {
font-family: "MS Sans Serif";
font-size: "8pt";
}
INPUT {
font-family: "MS Sans Serif";
font-size: "8pt";
}
INPUT.fmButton {
font-family: "MS Sans Serif";
font-size: "8pt";
background-Color: "#C5DEFD";
}
INPUT.actionButton {
font-family: "MS Sans Serif";
font-size: "8pt";
background-Color: "#C5DEFD";
margin-bottom: "5px";
}
TD.wingdings {
color: white;
font-family: "wingdings 2";
font-size: 12pt;
width: 12;
}
TD.white {
color: white;
font-family: MS Sans Serif;
font-size: 12pt;
width: 12;
}
SELECT.multiSelect {
font-family: MS Sans Serif;
font-size: 8pt;
width: 180
}
SELECT {
border-top: "1 none buttonhighlight";
border-left: "1 none buttonhighlight";
border-right: "1 none buttonshadow";
border-bottom: "1 none buttonshadow";
}
</style>
<body bgcolor="#CCCCCC">
<xsl:if test="@display='NORMAL'">
<xsl:call-template name="CREATE-NORMAL" />
</xsl:if>
</body>
</html>
</xsl:template>
<xsl:template name="CREATE-NORMAL">
<fieldset class="theStyle">
<legend style="font-weight:bold">
<xsl:value-of select="@title" />
</legend>
<br />
<xsl:for-each select="child::*">
<xsl:if test="name()='NONRECURSIVE'">
<xsl:variable name="hidden-elements" select="*[ATTRIBUTE/SUBTYPE[text()='HIDDEN']]" />
<xsl:for-each select="$hidden-elements">
<xsl:call-template name="CREATE-ELEMENT">
<xsl:with-param name="add-field-text" select="1" />
</xsl:call-template>
</xsl:for-each>
</xsl:if>
<xsl:if test="name()='RECURSIVE'">
</xsl:if>
</xsl:for-each>
</fieldset>
<xsl:for-each select="child::*">
<xsl:if test="name()='NONRECURSIVE'">
<xsl:variable name="number-of-multi-select-elements"
select="count(*[ATTRIBUTE/TYPE[text()='MULTIPLE_SELECT']])" />
<xsl:if test="$number-of-multi-select-elements > 0">
<br />
<fieldset style="padding:6">
<br />
<table border="0" cellspacing="0" cellpadding="0">
<xsl:call-template name="CREATE-MULTI-SEL-TABLE">
</xsl:call-template>
</table>
</fieldset>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="CREATE-ELEMENT">
<xsl:param name="add-field-text" select="0" />
<xsl:param name="element-style" select="0" />
<xsl:param name="recursive-table" select="0" />
<xsl:param name="actions-section" select="0" />
<xsl:for-each select="child::*">
<xsl:if test="name()='ATTRIBUTE'">
<xsl:choose>
<xsl:when test="SUBTYPE!=''">
<xsl:choose>
<xsl:when test="SUBTYPE!='LOOKAHEAD'">
<xsl:if test="$add-field-text = 0">
<xsl:value-of select="FIELD_TEXT" />
 
</xsl:if>
<xsl:element name="{TYPE}">
<xsl:attribute name="TYPE">
<xsl:value-of select="SUBTYPE" />
</xsl:attribute>
<xsl:attribute name="NAME">
<xsl:value-of select="NAME" />
</xsl:attribute>
<xsl:attribute name="TITLE">
<xsl:value-of select="TITLE" />
</xsl:attribute>
<xsl:attribute name="VALUE">
<xsl:value-of select="VALUE" />
</xsl:attribute>
<xsl:attribute name="db_type">
<xsl:value-of select="DB_TYPE" />
</xsl:attribute>
<xsl:attribute name="SIZE">
<xsl:value-of select="SIZE" />
</xsl:attribute>
<xsl:choose>
<xsl:when test="SUBTYPE = 'BUTTON' and $actions-section = 1">
<xsl:attribute name="CLASS">actionButton</xsl:attribute>
</xsl:when>
<xsl:when test="SUBTYPE = 'BUTTON'">
<xsl:attribute name="CLASS">fmButton</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:attribute name="STYLE">
<xsl:if test="$element-style = 1">
font-family:Arial;
font-size:8pt;
</xsl:if>
<xsl:if test="$element-style = 0">
border-bottom:0px solid;
border-left:0px solid;
border-right:0px solid;
border-top:0px solid;
font-family:Arial;
font-size:8pt;
</xsl:if>
<xsl:if test="SUBTYPE = 'CHECKBOX'">
width:18;
height:18;
</xsl:if>
<xsl:if test="$add-field-text = 1 and $recursive-table != 1">
width:120;
</xsl:if>
<xsl:if test="$recursive-table = 1">
width:
<xsl:value-of select="SIZE" />
;
</xsl:if>
</xsl:attribute>
<xsl:for-each select="EVENTS/*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<SPAN style="font-family:Arial;font-size:8pt;" width="120">
<xsl:element name="{TYPE}">
<xsl:attribute name="TYPE">text</xsl:attribute>
<xsl:attribute name="NAME">
<xsl:value-of select="NAME" />
</xsl:attribute>
<xsl:attribute name="TITLE">
<xsl:value-of select="TITLE" />
</xsl:attribute>
<xsl:attribute name="VALUE">
<xsl:value-of select="VALUE" />
</xsl:attribute>
<xsl:attribute name="db_type">
<xsl:value-of select="DB_TYPE" />
</xsl:attribute>
<xsl:attribute name="SIZE">
<xsl:value-of select="SIZE" />
</xsl:attribute>
<xsl:attribute name="bound_data">
<xsl:value-of select="BOUND_DATA" />
</xsl:attribute>
<xsl:attribute name="STYLE">
<xsl:if test="$element-style = 1">
font-family:Arial;
font-size:8pt;
</xsl:if>
<xsl:if test="$element-style = 0">
border-bottom:0px solid;
border-left:0px solid;
border-right:0px solid;
border-top:0px solid;
font-family:Arial;
font-size:8pt;
</xsl:if>
<xsl:if test="$add-field-text = 1 and $recursive-table != 1">
width:105;
</xsl:if>
<xsl:if test="$recursive-table = 1">
width:
<xsl:value-of select="SIZE" />
;
</xsl:if>
</xsl:attribute>
<xsl:for-each select="EVENTS/*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
</xsl:element>
<img hspace="2"
style="font-family:Arial;font-size:8pt;zoom:100%;cursor:pointer;vertical-align: middle"
onClick="if(get_element('{NAME}').value=='' || get_element('{NAME}').value=='< Mandatory >' || get_element('{NAME}').value=='< M >') get_element('{NAME}').value='%'; get_element('{NAME}').fireEvent('ONCHANGE')"
tabindex="-1"
src="" />
</SPAN>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$add-field-text = 0">
<xsl:value-of select="FIELD_TEXT" />
</xsl:if>
<xsl:element name="{TYPE}">
<xsl:if test="TYPE = 'DIV'">
<xsl:attribute name="ID">
<xsl:value-of select="NAME" />
</xsl:attribute>
</xsl:if>
<xsl:if test="TYPE != 'DIV'">
<xsl:attribute name="NAME">
<xsl:value-of select="NAME" />
</xsl:attribute>
</xsl:if>
<xsl:attribute name="TITLE">
<xsl:value-of select="TITLE" />
</xsl:attribute>
<xsl:attribute name="STYLE">
<xsl:if test="$add-field-text = 1 and $recursive-table != 1">
width:120;
</xsl:if>
<xsl:if test="$recursive-table = 1">
width:
<xsl:value-of select="SIZE" />
;
</xsl:if>
font-family:Arial;
font-size:7pt;
border-bottom:0px solid;
border-left:0px solid;
border-right:0px solid;
border-top:0px solid;
</xsl:attribute>
<xsl:for-each select="EVENTS/*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
<xsl:if test="TYPE='HIDDEN'">
 
</xsl:if>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:call-template name="CREATE-ELEMENT" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
</xml>
<HEAD>
<SCRIPT>
/* FORM LOADED */
function formLoaded()
{
try {
create_form();
}
catch (errorObject) {
var sErrmsg = "Error in JavaScript function formLoaded()";
handle_js_error(sErrmsg, errorObject.description);
}
}
// Parse String to XML
function StringToXML(txt)
{
let xml;
if (window.DOMParser) {
// code for Chrome, Firefox, Opera, IE9+, Edge
parser = new DOMParser();
xml = parser.parseFromString(txt, "text/xml");
} else {
// code for IEs prior to 9
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.loadXML(txt);
};
return xml;
};
function create_form()
{
try {
if (window.ActiveXObject) {
//Version IE
document.formDiv.innerHTML = document.all.XMLFormData.transformNode(document.all.XSLDefaultForm);
} else {
var xmlData = document.getElementById("XMLFormData").innerText;
xmlData = StringToXML(xmlData);
var xslData = document.getElementById("XSLDefaultForm").innerText;
xslData = StringToXML(xslData);
//console.log("XML Form Data");
//console.log(xmlData);
//console.log("XSL Conversion Data");
//console.log(xslData);
//console.log("New line please");
var errors = xmlData.getElementsByTagName('parsererror');
if (errors[0].textContent) {
var fullErrorText = errors[0].textContent;
fullErrorText = fullErrorText.replace("This page contains the following errors:", "")
fullErrorText = fullErrorText.replace("Below is a rendering of the page up to the first error.", "")
console.log(fullErrorText);
}
//Version ECMA
var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xslData);
var result = xsltProcessor.transformToDocument(xmlData);
console.log(result);
if (!result) result = "This was null";
//var serializer = new XMLSerializer();
//var str = serializer.serializeToString(result);
document.getElementById("formDiv").innerHTML = result;
}
} catch (errorObject) {
var sErrmsg = "Error has occurred in create_form()";
console.log(sErrmsg);
}
}
function handle_js_error(sMsg, sDesc)
{
try {
//alert(sMsg + "\n\n" + sDesc);
} catch (errorObject) {
var sErrmsg = "Error has occurred in handle_js_error()";
handle_js_error(sErrmsg, errorObject.description);
}
}
</SCRIPT>
<TITLE>XXX</TITLE>
</HEAD>
<BODY onLoad="formLoaded()" bgColor="#FFFFFF">
<DIV id=bigFatDiv>
<DIV style="text-align: center;">
<B style="font-family:MS Sans Serif; font-size:8pt;">
Testing XSLT
</B>
</DIV>
<HR color="red" size="1px">
</HR>
<DIV style="text-align: center;">
<TABLE cellpadding=10 cellspacing=2
style="border:0; background-Color:#E1EEFF;border-Left:black 1px solid;border-Top:black 1px solid;border-Right:black 1px solid;border-Bottom:black 1px solid;"
WIDTH=1000>
<TR>
<TD>
<DIV id="formDiv"></DIV>
</TD>
</TR>
</TABLE>
</DIV>
</DIV>
</BODY>
</HTML>
运行截取的结果是:
error on line 30 at column 34: StartTag: invalid element name
调查时是这样的:
<SIZE>
完全不可疑的线路。所以也许社区中的某个人可以指出我做错了什么,或者我是否应该对 XML/XSL 转换使用不同的原生 JS 方法。如果需要更多详细信息或有帮助,请告诉我。
答案 0 :(得分:1)
我认为您不应该期望能够将 XML 标记填充到任意 HTML 元素中,然后期望通过 innerText
取回 XML 标记。
可能有机会使用 script
元素,例如<script type="application/xslt+xml"></script>
或例如<script type="application/xml"></script>
作为容器元素,然后使用 text
元素 https://html.spec.whatwg.org/multipage/scripting.html#dom-script-text 的 script
属性获取“脚本数据”,例如在您的情况下是 XML 或 XSLT 标记。但作为任意 HTML 元素中的正常标记,HTML 解析器可能已损坏 XML 语法,并且 innerText
是从损坏的内容生成的。
var domParser = new DOMParser();
var xmlDoc1 = domParser.parseFromString(document.getElementById('xml-input1').text, 'application/xml');
var sheet1 = domParser.parseFromString(document.getElementById('xslt-code1').text, 'application/xml');
var processor = new XSLTProcessor();
processor.importStylesheet(sheet1);
document.getElementById('xslt-result1').appendChild(processor.transformToFragment(xmlDoc1, document));
TD.datagridHeader {
border-Top: "1 solid buttonhighlight";
border-Left: "1 solid buttonhighlight";
border-Right: "1 solid buttonshadow";
border-Bottom: "1 solid buttonshadow";
background-Color: "#C5DEFD";
font-family: "MS Sans Serif";
font-size: "8pt";
padding: "2";
}
TD.datagridField {
border-Top: "1 solid buttonhighlight";
border-Left: "1 solid buttonhighlight";
border-Right: "1 solid buttonshadow";
border-Bottom: "1 solid buttonshadow";
background-color: "#FFFFFF";
font-size: "8pt";
text-align: "RIGHT";
}
FIELDSET.theStyle {
padding: "6";
font-family: "MS Sans Serif";
font-size: "8pt";
width: "1000";
}
TD.emptyTD {
font-family: "MS Sans Serif";
font-size: "8pt";
}
INPUT {
font-family: "MS Sans Serif";
font-size: "8pt";
}
INPUT.fmButton {
font-family: "MS Sans Serif";
font-size: "8pt";
background-Color: "#C5DEFD";
}
INPUT.actionButton {
font-family: "MS Sans Serif";
font-size: "8pt";
background-Color: "#C5DEFD";
margin-bottom: "5px";
}
TD.wingdings {
color: white;
font-family: "wingdings 2";
font-size: 12pt;
width: 12;
}
TD.white {
color: white;
font-family: MS Sans Serif;
font-size: 12pt;
width: 12;
}
SELECT.multiSelect {
font-family: MS Sans Serif;
font-size: 8pt;
width: 180
}
SELECT {
border-top: "1 none buttonhighlight";
border-left: "1 none buttonhighlight";
border-right: "1 none buttonshadow";
border-bottom: "1 none buttonshadow";
}
<script type="application/xml" id="xml-input1"><?xml version="1.0" encoding="UTF-8" ?>
<FORM>
<SECTION title="SuperSection" id="0">
<NONRECURSIVE>
<ELEMENT>
<ATTRIBUTE>
<TYPE>
<![CDATA[IFT]]>
</TYPE>
<SUBTYPE>
<![CDATA[]]>
</SUBTYPE>
<NAME>
<![CDATA[DFLTF]]>
</NAME>
<DB_TYPE>
<![CDATA[V]]>
</DB_TYPE>
<FIELD_TEXT>
<![CDATA[]]>
</FIELD_TEXT>
<BOUND_DATA>
<![CDATA[]]>
</BOUND_DATA>
<SIZE>
<![CDATA[]]>
</SIZE>
<TITLE>
<![CDATA[SOME TEXT]]>
</TITLE>
<VALUE>
<![CDATA[]]>
</VALUE>
<EVENTS>
<![CDATA[]]>
</EVENTS>
</ATTRIBUTE>
</ELEMENT>
</NONRECURSIVE>
</SECTION>
</FORM></script>
<script type="application/xslt+xml" id="xslt-code1"><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration="yes" standalone="yes" indent="yes" media-type="text/html" />
<xsl:template match="/FORM/SECTION">
<xsl:call-template name="CREATE-NORMAL" />
</xsl:template>
<xsl:template name="CREATE-NORMAL">
<fieldset class="theStyle">
<legend style="font-weight:bold">
<xsl:value-of select="@title" />
</legend>
<br />
<xsl:for-each select="child::*">
<xsl:if test="name()='NONRECURSIVE'">
<xsl:variable name="hidden-elements" select="*[ATTRIBUTE/SUBTYPE[text()='HIDDEN']]" />
<xsl:for-each select="$hidden-elements">
<xsl:call-template name="CREATE-ELEMENT">
<xsl:with-param name="add-field-text" select="1" />
</xsl:call-template>
</xsl:for-each>
</xsl:if>
<xsl:if test="name()='RECURSIVE'">
</xsl:if>
</xsl:for-each>
</fieldset>
<xsl:for-each select="child::*">
<xsl:if test="name()='NONRECURSIVE'">
<xsl:variable name="number-of-multi-select-elements"
select="count(*[ATTRIBUTE/TYPE[text()='MULTIPLE_SELECT']])" />
<xsl:if test="$number-of-multi-select-elements > 0">
<br />
<fieldset style="padding:6">
<br />
<table border="0" cellspacing="0" cellpadding="0">
<xsl:call-template name="CREATE-MULTI-SEL-TABLE">
</xsl:call-template>
</table>
</fieldset>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="CREATE-ELEMENT">
<xsl:param name="add-field-text" select="0" />
<xsl:param name="element-style" select="0" />
<xsl:param name="recursive-table" select="0" />
<xsl:param name="actions-section" select="0" />
<xsl:for-each select="child::*">
<xsl:if test="name()='ATTRIBUTE'">
<xsl:choose>
<xsl:when test="SUBTYPE!=''">
<xsl:choose>
<xsl:when test="SUBTYPE!='LOOKAHEAD'">
<xsl:if test="$add-field-text = 0">
<xsl:value-of select="FIELD_TEXT" />
 
</xsl:if>
<xsl:element name="{TYPE}">
<xsl:attribute name="TYPE">
<xsl:value-of select="SUBTYPE" />
</xsl:attribute>
<xsl:attribute name="NAME">
<xsl:value-of select="NAME" />
</xsl:attribute>
<xsl:attribute name="TITLE">
<xsl:value-of select="TITLE" />
</xsl:attribute>
<xsl:attribute name="VALUE">
<xsl:value-of select="VALUE" />
</xsl:attribute>
<xsl:attribute name="db_type">
<xsl:value-of select="DB_TYPE" />
</xsl:attribute>
<xsl:attribute name="SIZE">
<xsl:value-of select="SIZE" />
</xsl:attribute>
<xsl:choose>
<xsl:when test="SUBTYPE = 'BUTTON' and $actions-section = 1">
<xsl:attribute name="CLASS">actionButton</xsl:attribute>
</xsl:when>
<xsl:when test="SUBTYPE = 'BUTTON'">
<xsl:attribute name="CLASS">fmButton</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:attribute name="STYLE">
<xsl:if test="$element-style = 1">
font-family:Arial;
font-size:8pt;
</xsl:if>
<xsl:if test="$element-style = 0">
border-bottom:0px solid;
border-left:0px solid;
border-right:0px solid;
border-top:0px solid;
font-family:Arial;
font-size:8pt;
</xsl:if>
<xsl:if test="SUBTYPE = 'CHECKBOX'">
width:18;
height:18;
</xsl:if>
<xsl:if test="$add-field-text = 1 and $recursive-table != 1">
width:120;
</xsl:if>
<xsl:if test="$recursive-table = 1">
width:
<xsl:value-of select="SIZE" />
;
</xsl:if>
</xsl:attribute>
<xsl:for-each select="EVENTS/*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<SPAN style="font-family:Arial;font-size:8pt;" width="120">
<xsl:element name="{TYPE}">
<xsl:attribute name="TYPE">text</xsl:attribute>
<xsl:attribute name="NAME">
<xsl:value-of select="NAME" />
</xsl:attribute>
<xsl:attribute name="TITLE">
<xsl:value-of select="TITLE" />
</xsl:attribute>
<xsl:attribute name="VALUE">
<xsl:value-of select="VALUE" />
</xsl:attribute>
<xsl:attribute name="db_type">
<xsl:value-of select="DB_TYPE" />
</xsl:attribute>
<xsl:attribute name="SIZE">
<xsl:value-of select="SIZE" />
</xsl:attribute>
<xsl:attribute name="bound_data">
<xsl:value-of select="BOUND_DATA" />
</xsl:attribute>
<xsl:attribute name="STYLE">
<xsl:if test="$element-style = 1">
font-family:Arial;
font-size:8pt;
</xsl:if>
<xsl:if test="$element-style = 0">
border-bottom:0px solid;
border-left:0px solid;
border-right:0px solid;
border-top:0px solid;
font-family:Arial;
font-size:8pt;
</xsl:if>
<xsl:if test="$add-field-text = 1 and $recursive-table != 1">
width:105;
</xsl:if>
<xsl:if test="$recursive-table = 1">
width:
<xsl:value-of select="SIZE" />
;
</xsl:if>
</xsl:attribute>
<xsl:for-each select="EVENTS/*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
</xsl:element>
<img hspace="2"
style="font-family:Arial;font-size:8pt;zoom:100%;cursor:pointer;vertical-align: middle"
onClick="if(get_element('{NAME}').value=='' || get_element('{NAME}').value=='< Mandatory >' || get_element('{NAME}').value=='< M >') get_element('{NAME}').value='%'; get_element('{NAME}').fireEvent('ONCHANGE')"
tabindex="-1"
src="" />
</SPAN>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$add-field-text = 0">
<xsl:value-of select="FIELD_TEXT" />
</xsl:if>
<xsl:element name="{TYPE}">
<xsl:if test="TYPE = 'DIV'">
<xsl:attribute name="ID">
<xsl:value-of select="NAME" />
</xsl:attribute>
</xsl:if>
<xsl:if test="TYPE != 'DIV'">
<xsl:attribute name="NAME">
<xsl:value-of select="NAME" />
</xsl:attribute>
</xsl:if>
<xsl:attribute name="TITLE">
<xsl:value-of select="TITLE" />
</xsl:attribute>
<xsl:attribute name="STYLE">
<xsl:if test="$add-field-text = 1 and $recursive-table != 1">
width:120;
</xsl:if>
<xsl:if test="$recursive-table = 1">
width:
<xsl:value-of select="SIZE" />
;
</xsl:if>
font-family:Arial;
font-size:7pt;
border-bottom:0px solid;
border-left:0px solid;
border-right:0px solid;
border-top:0px solid;
</xsl:attribute>
<xsl:for-each select="EVENTS/*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
<xsl:if test="TYPE='HIDDEN'">
 
</xsl:if>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:call-template name="CREATE-ELEMENT" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet></script>
<div id="xslt-result1"></div>