您的位置:首页 > 其它

XSL 语言入门5 -- xsl实际项目应用示例2

2013-03-27 14:58 393 查看
道理和上一篇文章一样:

XSL 语言入门4 -- xsl实际项目应用示例1

/article/7742214.html

xml文档MAP_HISTORY_NPATROL_Edit.xml:

<?xml version="1.0" encoding="GBK"?>
<?xml-stylesheet type="text/xsl" href="MAP_HISTORY_NPATROL_Edit.xsl"?>
<columns table="MAP_HISTORY_NPATROL" isWorkOrder="true" flowID="D0000000018" flowName="计划巡维单流程" actionName="填单" title="新计划巡维工单编辑" token="607A7545-6F56-E0E0-6A7F-855B733E5524">
<column seqId="000" feildName="JHXWGUID" feildTitle="GUID" feildType="VARCHAR2" feildLen1="40" feildLen2="" feildNull="false" feildKey="true" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="false" readOnly="true" align="right" rule="Guid" when="before">
</column>
<column seqId="044" feildName="ROOTID" feildTitle="ROOTID" feildType="VARCHAR2" feildLen1="30" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="false" readOnly="true" align="left" rule="FlowInstID" when="before">
</column>
<column seqId="001" feildName="JHXWGDH" feildTitle="计划巡维工单号" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="JHXWGDH" when="before">
</column>
<column seqId="002" feildName="TXR" feildTitle="填写人" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="R" visible="true" readOnly="false" align="center" rule="UserTitle" when="before">
</column>
<column seqId="003" feildName="TXRDW" feildTitle="填写人单位" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="R" visible="true" readOnly="false" align="center" rule="DeptName" when="before">
</column>
<column seqId="004" feildName="TXSJ" feildTitle="填写时间" feildType="DATE" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="W" visible="true" readOnly="false" align="left" rule="" when="">
</column>
<column seqId="005" feildName="TXRLXDH" feildTitle="填写人联系电话" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="W" visible="true" readOnly="false" align="left" rule="" when="">
</column>
<column seqId="006" feildName="SDR" feildTitle="收单人" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="W" visible="true" readOnly="false" align="left" rule="" when="">
</column>
<column seqId="007" feildName="SDRDW" feildTitle="收单人单位" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="W" visible="true" readOnly="false" align="left" rule="" when="">
</column>
<column seqId="008" feildName="SDRLXDH" feildTitle="收单人联系电话" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="W" visible="true" readOnly="false" align="left" rule="" when="">
</column>
<column seqId="009" feildName="SDSJ" feildTitle="收单时间" feildType="DATE" feildLen1="10" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="W" visible="true" readOnly="false" align="left" rule="" when="">
</column>
<column seqId="010" feildName="KHHH" feildTitle="客户户号" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="011" feildName="KHDZ" feildTitle="客户地址" feildType="VARCHAR2" feildLen1="100" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="012" feildName="SSFJ" feildTitle="所属分局" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="013" feildName="SSXL" feildTitle="所属线路" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="014" feildName="ZDZCH" feildTitle="终端资产号" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="015" feildName="LJDZ" feildTitle="逻辑地址" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="016" feildName="ZDLX" feildTitle="终端类型" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="017" feildName="ZDCJ" feildTitle="终端厂家" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="018" feildName="SIMKH" feildTitle="SIM卡号" feildType="VARCHAR2" feildLen1="30" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="019" feildName="DBZCH" feildTitle="电表资产号" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="020" feildName="DBCJ" feildTitle="电表厂家" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="021" feildName="DBDZ" feildTitle="电表地址" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="022" feildName="CTBB" feildTitle="CT变比" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="023" feildName="PTBB" feildTitle="PT变比" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="024" feildName="BYQRL" feildTitle="变压器容量" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="025" feildName="BMDS" feildTitle="终端ID" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="026" feildName="YGZ" feildTitle="有功总" feildType="VARCHAR2" feildLen1="30" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="027" feildName="YGP" feildTitle="有功平" feildType="VARCHAR2" feildLen1="30" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="028" feildName="YGF" feildTitle="有功峰" feildType="VARCHAR2" feildLen1="30" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="029" feildName="YGG" feildTitle="有功谷" feildType="VARCHAR2" feildLen1="30" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="030" feildName="GZNR" feildTitle="工作内容" feildType="VARCHAR2" feildLen1="100" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="031" feildName="SPR" feildTitle="审批人" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="032" feildName="SPDW" feildTitle="审批单位" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="033" feildName="SPSJ" feildTitle="审批时间" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="034" feildName="SPYJ" feildTitle="审批意见" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="035" feildName="DYQXGDH" feildTitle="对应抢修工单号" feildType="VARCHAR2" feildLen1="30" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="036" feildName="CLR" feildTitle="处理人" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="037" feildName="CLRDW" feildTitle="处理人单位" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="038" feildName="CLSJ" feildTitle="处理时间" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="039" feildName="YSR" feildTitle="验收人" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="040" feildName="YSRDW" feildTitle="验收人单位" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="041" feildName="YSSJ" feildTitle="验收时间" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="042" feildName="YSYJ" feildTitle="验收意见" feildType="VARCHAR2" feildLen1="100" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="043" feildName="FLAG" feildTitle="FLAG" feildType="VARCHAR2" feildLen1="20" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="FlowFlag" when="before">
</column>
<column seqId="045" feildName="KHMC" feildTitle="客户名称" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="046" feildName="CLJG" feildTitle="处理结果" feildType="VARCHAR2" feildLen1="100" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="047" feildName="FXYGZ" feildTitle="反向有功总" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="048" feildName="FXYGF" feildTitle="反向有功峰" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="049" feildName="FXYGP" feildTitle="反向有功平" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
<column seqId="050" feildName="FXYGG" feildTitle="反向有功谷" feildType="VARCHAR2" feildLen1="50" feildLen2="" feildNull="true" feildKey="false" defaultValue="" feildDescribe="" feildProperty="" feildValue="" feildRight="" visible="true" readOnly="true" align="left" rule="" when="">
</column>
</columns>


xsl文档MAP_HISTORY_NPATROL_Edit.xsl(太长只给出部分代码):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/public.css"/>
<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"/>
<style type="text/css">
input{ width:100%; }
</style>
</head>
<body>
<!--
<div>
<xsl:value-of select="columns/attribute::title"/>
</div>
-->
<table style="width:800;" width="100%">
<!--
隐藏行中包括table、isWorkOrder、flowID、flowName、actionName、token等信息
-->
<tr id="hiddenTr" style="display:none;" width="100%">
<!-- display:none; -->
<!-- 字段 table -->
<td width="17%">
<xsl:attribute name="id">table</xsl:attribute>
<xsl:attribute name="name">table</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="columns/attribute::table"/></xsl:attribute>
<xsl:value-of select="columns/attribute::table"/>
</td>
<!-- 字段 isWorkOrder -->
<td width="17%">
<xsl:attribute name="id">isWorkOrder</xsl:attribute>
<xsl:attribute name="name">isWorkOrder</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="columns/attribute::isWorkOrder"/></xsl:attribute>
<xsl:value-of select="columns/attribute::isWorkOrder"/>
</td>
<!-- 字段 flowID -->
<td width="17%">
<xsl:attribute name="id">flowID</xsl:attribute>
<xsl:attribute name="name">flowID</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="columns/attribute::flowID"/></xsl:attribute>
<xsl:value-of select="columns/attribute::flowID"/>
</td>
<!-- 字段 flowName -->
<td width="17%">
<xsl:attribute name="id">flowName</xsl:attribute>
<xsl:attribute name="name">flowName</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="columns/attribute::flowName"/></xsl:attribute>
<xsl:value-of select="columns/attribute::flowName"/>
</td>
<!-- 字段 actionName -->
<td width="16%">
<xsl:attribute name="id">actionName</xsl:attribute>
<xsl:attribute name="name">actionName</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="columns/attribute::actionName"/></xsl:attribute>
<xsl:value-of select="columns/attribute::actionName"/>
</td>
<!-- 字段 token -->
<td width="16%">
<xsl:attribute name="id">token</xsl:attribute>
<xsl:attribute name="name">token</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="columns/attribute::token"/></xsl:attribute>
<xsl:value-of select="columns/attribute::token"/>
</td>
</tr>
<!-- 要在页面中显示的字段 -->
<xsl:variable name="tdStyle"/>
<!-- 定义变量tdStyle -->
<tr>
<xsl:for-each select="columns/column">
<!-- 此列只有此一个字段,所以隐藏改行;若有>1个字段,则不需隐藏此行 -->
<xsl:attribute name="style">
<xsl:if test="./@visible='false'">display:none;</xsl:if>
</xsl:attribute>

<!-- 字段 JHXWGUID -->
<xsl:if test="./@feildName='JHXWGUID'">
<td width="18%">
<xsl:attribute name="align"><xsl:value-of select="./@align"/></xsl:attribute>
<!-- 判断是否隐藏此列 -->
<xsl:attribute name="style">
<xsl:if test="./@visible='false'">display:none;</xsl:if>
</xsl:attribute>

<xsl:value-of select="./@feildTitle"/>
<xsl:if test="./@feildKey='true'">
<span style="color:#E58A22;font-weight:bold;font-size:15px;">(PK)</span>
</xsl:if>
</td>
<td colspan="2" width="32%">
<xsl:choose>
<xsl:when test="./child::*">
<!-- select -->
<xsl:if test="./feildDef/options/option">
<select>
<!-- id 属性 -->
<xsl:attribute name="id"><xsl:value-of select="./@feildName"/></xsl:attribute>
<!-- name 属性 -->
<xsl:attribute name="name"><xsl:value-of select="./@feildName"/></xsl:attribute>
<xsl:for-each select="./feildDef/options/option">
<option>
<xsl:value-of select="./@value"/>
</option>
</xsl:for-each>
</select>
</xsl:if>
</xsl:when>

<xsl:otherwise>
<!-- input -->
<xsl:if test="./@feildLen1 < 100">
<input width="100%">
<!-- id 属性 -->
<xsl:attribute name="id"><xsl:value-of select="./@feildName"/></xsl:attribute>
<!-- name 属性 -->
<xsl:attribute name="name"><xsl:value-of select="./@feildName"/></xsl:attribute>
<!-- type 属性 -->
<xsl:attribute name="type">text</xsl:attribute>
<!-- maxLength 属性 -->
<xsl:attribute name="maxLength"><xsl:if test="./@feildLen2 = ''"><xsl:value-of select="./@feildLen1"/></xsl:if></xsl:attribute>
<!-- 时间下拉框样式 属性 -->
<xsl:if test="./@feildType = 'TIMESTAMP'">
<xsl:attribute name="onfocus">WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})</xsl:attribute>
<xsl:attribute name="class">Wdate</xsl:attribute>
</xsl:if>
<xsl:if test="./@feildType = 'DATE'">
<xsl:attribute name="onfocus">WdatePicker({dateFmt:'yyyy-MM-dd'})</xsl:attribute>
<xsl:attribute name="class">Wdate</xsl:attribute>
</xsl:if>
<!-- style 属性 -->
<xsl:attribute name="style">
<xsl:if test="./@when != ''">when:<xsl:value-of select="./@when"></xsl:value-of>;</xsl:if>
<xsl:if test="./@rule != ''">rule:<xsl:value-of select="./@rule"></xsl:value-of>;</xsl:if>
<xsl:if test="./@feildKey='true'">pk:true;</xsl:if>
<xsl:if test="./@feildLen2 != ''">
length:<xsl:value-of select="./@feildLen1"/>-<xsl:value-of select="./@feildLen2"/>;
</xsl:if>
<!-- visible 属性 -->
<xsl:if test="./@visible = 'false'">
<xsl:text>display:none;</xsl:text>
</xsl:if>
<!-- 是否是工单 -->
<xsl:if test="../attribute::isWorkOrder = 'true'">
<xsl:if test="./@feildRight = ''">
<xsl:text>border-style:none;</xsl:text>
</xsl:if>
<xsl:if test="./@feildRight = 'R'">
<xsl:text>border-color:red;</xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="../attribute::isWorkOrder = 'false'">
<xsl:if test="./@readOnly = 'true'">
<xsl:text>border-style:none;</xsl:text>
</xsl:if>
<xsl:if test="./@feildNull = 'false'">
<xsl:text>border-color:red;</xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="./@feildType = 'NUMBER'">
<xsl:text>dataType:NUMBER;</xsl:text>
</xsl:if>
<xsl:if test="./@feildType = 'VARCHAR2' or ./@feildType = 'VARCHAR'">
<xsl:text>dataType:STRING;</xsl:text>
</xsl:if>
<!-- 时间下拉框样式 属性 -->
<xsl:if test="./@feildType = 'TIMESTAMP'">
<xsl:text>dataType:TIMESTAMP;</xsl:text>
</xsl:if>
<xsl:if test="./@feildType = 'DATE'">
<xsl:text>dataType:DATE;</xsl:text>
</xsl:if>
</xsl:attribute>
<!-- readonly 属性 -->
<xsl:if test="../attribute::isWorkOrder = 'true'">
<xsl:if test="./@feildRight = ''">
<xsl:attribute name="readonly">true</xsl:attribute>
</xsl:if>
</xsl:if>
<xsl:if test="../attribute::isWorkOrder = 'false'">
<xsl:if test="./@readOnly = 'true'">
<xsl:attribute name="readonly">true</xsl:attribute>
</xsl:if>
</xsl:if>
<!-- value 属性 -->
<xsl:attribute name="value"><xsl:value-of select="./@feildValue"/></xsl:attribute>
</input>
</xsl:if>
<!-- textarea -->
<xsl:if test="./@feildLen1 >= 100">
<textarea rows="3" cols="28">
<!-- id 属性 -->
<xsl:attribute name="id"><xsl:value-of select="./@feildName"/></xsl:attribute>
<!-- name 属性 -->
<xsl:attribute name="name"><xsl:value-of select="./@feildName"/></xsl:attribute>
<!-- text -->
<xsl:value-of select="./@feildValue"/>
<!-- readonly 属性 -->
<xsl:attribute name="readonly">
<xsl:if test="../attribute::isWorkOrder = 'true'">
<xsl:if test="./@feildRight = ''"><xsl:text>readonly</xsl:text></xsl:if>
</xsl:if>
<xsl:if test="../attribute::isWorkOrder = 'false'">
<xsl:if test="./@readOnly = 'true'"><xsl:text>readonly</xsl:text></xsl:if>
</xsl:if>
</xsl:attribute>
</textarea>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</td>
</xsl:if>

<!-- 字段 ROOTID-->
<xsl:if test="./@feildName='ROOTID'">
<td width="18%">
<xsl:attribute name="align"><xsl:value-of select="./@align"/></xsl:attribute>
<!-- 判断是否隐藏此列 -->
<xsl:attribute name="style">
<xsl:if test="./@visible='false'">display:none;</xsl:if>
</xsl:attribute>
<xsl:value-of select="./@feildTitle"/>
<xsl:if test="./@feildKey='true'">
<span style="color:#E58A22;font-weight:bold;font-size:15px;">(PK)</span>
</xsl:if>
</td>
<td colspan="2" width="32%">
<xsl:choose>
<xsl:when test="./child::*">
<!-- select -->
<xsl:if test="./feildDef/options/option">
<select>
<!-- id 属性 -->
<xsl:attribute name="id"><xsl:value-of select="./@feildName"/></xsl:attribute>
<!-- name 属性 -->
<xsl:attribute name="name"><xsl:value-of select="./@feildName"/></xsl:attribute>
<xsl:for-each select="./feildDef/options/option">
<option>
<xsl:value-of select="./@value"/>
</option>
</xsl:for-each>
</select>
</xsl:if>
</xsl:when>

<xsl:otherwise>
<!-- input -->
<xsl:if test="./@feildLen1 < 100">
<input width="100%">
<!-- id 属性 -->
<xsl:attribute name="id"><xsl:value-of select="./@feildName"/></xsl:attribute>
<!-- name 属性 -->
<xsl:attribute name="name"><xsl:value-of select="./@feildName"/></xsl:attribute>
<!-- type 属性 -->
<xsl:attribute name="type">text</xsl:attribute>
<!-- maxLength 属性 -->
<xsl:attribute name="maxLength"><xsl:if test="./@feildLen2 = ''"><xsl:value-of select="./@feildLen1"/></xsl:if></xsl:attribute>
<!-- 时间下拉框样式 属性 -->
<xsl:if test="./@feildType = 'TIMESTAMP'">
<xsl:attribute name="onfocus">WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})</xsl:attribute>
<xsl:attribute name="class">Wdate</xsl:attribute>
</xsl:if>
<xsl:if test="./@feildType = 'DATE'">
<xsl:attribute name="onfocus">WdatePicker({dateFmt:'yyyy-MM-dd'})</xsl:attribute>
<xsl:attribute name="class">Wdate</xsl:attribute>
</xsl:if>
<!-- style 属性 -->
<xsl:attribute name="style">
<xsl:if test="./@when != ''">when:<xsl:value-of select="./@when"></xsl:value-of>;</xsl:if>
<xsl:if test="./@rule != ''">rule:<xsl:value-of select="./@rule"></xsl:value-of>;</xsl:if>
<xsl:if test="./@feildKey='true'">pk:true;</xsl:if>
<xsl:if test="./@feildLen2 != ''">
length:<xsl:value-of select="./@feildLen1"/>-<xsl:value-of select="./@feildLen2"/>;
</xsl:if>
<!-- visible 属性 -->
<xsl:if test="./@visible = 'false'">
<xsl:text>display:none;</xsl:text>
</xsl:if>
<!-- 是否是工单 -->
<xsl:if test="../attribute::isWorkOrder = 'true'">
<xsl:if test="./@feildRight = ''">
<xsl:text>border-style:none;</xsl:text>
</xsl:if>
<xsl:if test="./@feildRight = 'R'">
<xsl:text>border-color:red;</xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="../attribute::isWorkOrder = 'false'">
<xsl:if test="./@readOnly = 'true'">
<xsl:text>border-style:none;</xsl:text>
</xsl:if>
<xsl:if test="./@feildNull = 'false'">
<xsl:text>border-color:red;</xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="./@feildType = 'NUMBER'">
<xsl:text>dataType:NUMBER;</xsl:text>
</xsl:if>
<xsl:if test="./@feildType = 'VARCHAR2' or ./@feildType = 'VARCHAR'">
<xsl:text>dataType:STRING;</xsl:text>
</xsl:if>
<!-- 时间下拉框样式 属性 -->
<xsl:if test="./@feildType = 'TIMESTAMP'">
<xsl:text>dataType:TIMESTAMP;</xsl:text>
</xsl:if>
<xsl:if test="./@feildType = 'DATE'">
<xsl:text>dataType:DATE;</xsl:text>
</xsl:if>
</xsl:attribute>
<!-- readonly 属性 -->
<xsl:if test="../attribute::isWorkOrder = 'true'">
<xsl:if test="./@feildRight = ''">
<xsl:attribute name="readonly">true</xsl:attribute>
</xsl:if>
</xsl:if>
<xsl:if test="../attribute::isWorkOrder = 'false'">
<xsl:if test="./@readOnly = 'true'">
<xsl:attribute name="readonly">true</xsl:attribute>
</xsl:if>
</xsl:if>
<!-- value 属性 -->
<xsl:attribute name="value"><xsl:value-of select="./@feildValue"/></xsl:attribute>
</input>
</xsl:if>
<!-- textarea -->
<xsl:if test="./@feildLen1 >= 100">
<textarea rows="3" cols="28">
<!-- id 属性 -->
<xsl:attribute name="id"><xsl:value-of select="./@feildName"/></xsl:attribute>
<!-- name 属性 -->
<xsl:attribute name="name"><xsl:value-of select="./@feildName"/></xsl:attribute>
<!-- text -->
<xsl:value-of select="./@feildValue"/>
<!-- readonly 属性 -->
<xsl:attribute name="readonly">
<xsl:if test="../attribute::isWorkOrder = 'true'">
<xsl:if test="./@feildRight = ''"><xsl:text>readonly</xsl:text></xsl:if>
</xsl:if>
<xsl:if test="../attribute::isWorkOrder = 'false'">
<xsl:if test="./@readOnly = 'true'"><xsl:text>readonly</xsl:text></xsl:if>
</xsl:if>
</xsl:attribute>
</textarea>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</td>
</xsl:if>
</xsl:for-each>
</tr>
......
......
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


预览结果(不完全展示):



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: