`
Java_Fan
  • 浏览: 82111 次
  • 性别: Icon_minigender_1
  • 来自: 西安
文章分类
社区版块
存档分类
最新评论

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

 
阅读更多

道理和上一篇文章一样:

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

http://blog.csdn.net/hu_shengyang/article/details/8726579


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>

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




分享到:
评论

相关推荐

    xsl-fo pdf

    1. **Hello World 示例**:介绍一个简单的“Hello World”示例,帮助初学者快速入门。 2. **打印表单规范**:详细说明如何在XSL-FO中定义打印表单的结构和样式。 3. **样例2 fo.xsl 样式表**:提供了一个具体的样例...

    xsl入门教程

    ### XSL 入门教程详解 #### 一、XML与XSL概述 随着互联网的快速发展,数据交换的需求日益增加,HTML作为一种标记语言逐渐暴露...通过这些基础知识的学习,您可以更深入地探索XML和XSL技术,并将其应用到实际项目中。

    xalanjava源码-cda-core-xsl:cda-核心-xsl

    3,即入门级信息。 执照 根据 Apache 许可,版本 2.0(“许可”)获得许可; 除非遵守许可,否则您不得使用此文件。 您可以在以下网址获取许可证副本 兼容性 CDA XSL 已经过测试,可以与 Saxon-PE 和主要浏览器一起...

    xslt从入门到精通(源代码)

    《XSLT从入门到精通》是一本深入探讨XSLT技术的专业书籍,它涵盖了XSLT的基础知识、进阶技巧以及实际应用案例。通过学习这本书的源代码,读者可以更好地理解和掌握XSLT在XML数据转换中的强大功能。XSLT是一种用于...

    XSLT轻松入门 详细例子介绍

    ### XSLT轻松入门知识点详解 #### 一、XSLT概述 **1.1 什么是XSLT** XSLT(eXtensible Stylesheet Language Transformations)是一种由W3C制定的标准语言,用于将XML文档转换为另一种格式的文档,如HTML或纯文本...

    Marchal - XML By Example

    作者Benoît Marchal通过丰富的示例来阐述XML的基础语法、高级特性以及实际应用场景,旨在帮助读者理解和掌握XML技术的核心要素。 #### 关键章节详解 **第1章:XML Galaxy(XML宇宙)** - **XML的历史与发展**:...

    XML入门经典 (第5版)源码

    《XML入门经典(第5版)》是一本深入浅出介绍XML基础和实践的书籍,源码部分通常包含了各种示例和练习,帮助读者更好地理解XML的语法和应用。 XML的核心概念包括: 1. **结构化数据**:XML通过标签定义数据的结构,...

    XSLT入门教程

    在“XSLT轻松入门第二章:XSLT的实例”中,你将看到实际的转换示例,这些例子将帮助你理解如何定义模板、应用模板以及如何处理XML文档的不同部分。这部分可能会包含如何创建简单的文本输出,如何转换元素和属性,...

    xml转换教程,ppt和示例代码

    本教程将帮助你深入理解XML转换,并通过PPT讲解和示例代码实践,让你从入门到精通。 首先,我们要理解XML的基本结构。XML文档由元素、属性、文本内容等组成。元素是XML的最基本构建块,用尖括号包围,如 `&lt;element&gt;...

    xslt实例(实际例子)

    2. **条件逻辑应用**:可能包含使用`&lt;xsl:if&gt;`、`&lt;xsl:when&gt;`和`&lt;xsl:otherwise&gt;`进行条件判断的例子。 3. **循环与迭代**:通过`&lt;xsl:for-each&gt;`标签处理XML节点集的实例。 4. **模板复用**:可能包含使用`&lt;xsl:...

    XML实用大全(绝对经典)

    ### XML实用大全(绝对经典) #### 一、XML概览 **XML**(eXtensible Markup Language)是一种标记语言,其设计目的是传输...通过以上内容,读者不仅可以了解XML的基础知识,还能深入了解XML的实际应用场景和技术细节。

    XSLT整理文档学习文档

    4. **应用场景示例** - **动易系统**:体现XSLT的数据和表达式分离,以及客户端转换的优势。 学习XSLT对于处理XML数据和构建可复用的前端展示至关重要。虽然学习曲线可能较陡,但其强大的功能和灵活性使得投入时间...

    XML精华学习入门

    在示例中,XML文档引用了XSL样式表`2.xsl`,通过模板匹配进行转换。`2.xsl`定义了一个模板,将`&lt;lisongtao&gt;`元素的内容包裹在HTML结构中,形成一个带有标题和背景色的网页。 至于注释,XML的注释与JavaScript类似,...

    C-#XML入门经典随书源码

    XML(eXtensible Markup Language...通过学习“C-#XML入门经典随书源码”,你将能够深入理解XML在C#中的应用,并具备实际开发中处理XML数据的能力。源码部分通常包含示例程序,帮助读者更好地理解和实践这些理论知识。

    无废话xml(劳虎,胭脂虎)

    本书通过简洁明了的语言介绍了XML的基本概念及其在实际应用中的作用,适合初学者快速入门。 #### XML简介 - **定义**:XML是一种标记语言,用于结构化文档,以便于数据交换。 - **特点**: - **开放性**:XML是一...

    软件开发人员必须的技术类网站

    在软件开发领域,掌握丰富的资源和技术文档对于提升个人技能、解决实际问题有着不可估量的作用。本文将详细介绍一系列对软件开发者非常有用的网站,涵盖各种语言和技术栈。 #### 1. GotAPI.com - **简介**:GotAPI....

    QT35-C#XML入门经典源代码全集

    QT35-C# XML入门经典源代码全集是一份针对初学者和开发者设计的资源,旨在帮助他们理解和掌握XML(可扩展标记语言)在C#编程环境中的应用。XML是一种广泛应用的数据交换和存储格式,因其结构化、自描述性而备受青睐...

    DOMSAXXSL入门小例子

    这篇教程将带你入门这三种技术的基础概念和应用。 DOM是一种基于树形结构的XML或HTML文档表示法,它将整个文档加载到内存中,形成一个可操作的对象模型。通过DOM,你可以方便地查找、修改或添加文档中的任何元素。...

    Nutch入门资料PDF格式

    - **Nutch**: 开源网络爬虫项目,基于Apache Hadoop构建,能够抓取和索引大量网络数据,广泛应用于搜索引擎开发。 - **环境搭建**: - **配置中文API文档**: - 将中文API文档配置到Tomcat服务器上,并确保可以通过`...

    XML初学入门教程(pdf)

    这一章节通常会给出一个实际的 XML 示例文档,以帮助学习者更好地理解 XML 的结构和语法。 ### 第十二章至第十三章:格式化 XML 这两章主要介绍了如何使用不同的技术来格式化 XML 文档,包括: 1. **XSLT**:用于...

Global site tag (gtag.js) - Google Analytics