1.example.xml--主要数据文件
<?xmlversion="1.0"encoding="UTF-8"?>
<?xml:stylesheettype="text/xsl"href="example.xsl"?>
<projectsid="1">
<projecttitle="一级标题1"index="1">
<itemsisTrunk="false"title="二级标题1.1"id="items_1">
<resulttype="2">1</result>
<officer><![CDATA[]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
<remark></remark>
</items>
<itemsisTrunk="false"title="二级标题1.2"id="items_2">
<resulttype="2">3</result>
<officer><![CDATA[]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</items>
</project>
<projecttitle="一级标题2"index="2">
<itemsisTrunk="false"title="二级标题2.1"id="items_3">
<resulttype="3">3</result>
<officer><![CDATA[]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</items>
<itemsisTrunk="true"title="二级标题2.2">
<itemtitle="三级标题2.2.1"id="item_1">
<resulttype="1">2</result>
<officer><![CDATA[居然是乱码]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</item>
<itemtitle="三级标题2.2.2"id="item_2">
<resulttype="1">3</result>
<officer><![CDATA[<><>]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</item>
</items>
<itemsisTrunk="true"title="二级标题2.3">
<itemtitle="三级标题2.3.1"id="item_3">
<resulttype="2">1</result>
<officer><![CDATA[]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</item>
<itemtitle="三级标题2.3.2"id="item_4">
<resulttype="2">1</result>
<officer><![CDATA[]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</item>
</items>
</project>
<projecttitle="一级标题3"index="3">
<itemsisTrunk="false"title="二级标题3.1"id="items_4">
<resulttype="4"units="元">25345</result>
<officer><![CDATA[sinoly]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</items>
<itemsisTrunk="false"title="二级标题3.2"id="items_5">
<resulttype="4"units="元">9865764</result>
<officer><![CDATA[]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</items>
<itemsisTrunk="false"title="二级标题3.3"id="items_6">
<resulttype="2">0</result>
<officer><![CDATA[]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</items>
<itemsisTrunk="true"title="二级标题3.4">
<itemtitle="三级标题3.4.1"id="item_5">
<resulttype="1">0</result>
<officer><![CDATA[]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</item>
<itemtitle="三级标题3.4.2"id="item_6">
<resulttype="1">0</result>
<officer><![CDATA[]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</item>
<itemtitle="三级标题3.4.3"id="item_7">
<resulttype="1">0</result>
<officer><![CDATA[]]></officer>
<classified>1</classified>
<eligibility>0</eligibility>
</item>
</items>
</project>
</projects>
2.example.xsl--样式文件,很方便的取到xml数据
<?xmlversion="1.0"encoding="gb2312"?>
<xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<>
<xsl:outputmethod="xml"/>
<xsl:templatematch="/">
<xsl:apply-templatesselect="projects/project"/>
<h6>
<buttontype="submit"class="btn1_mouseout"onmouseover="this.className='btn1_mouseover'"onmouseout="this.className='btn1_mouseout'"title="提交">下一步</button>
</h6>
</xsl:template>
<>
<xsl:templatematch="project">
<TABLEborder="0"cellspacing="0"cellpadding="0"class="table">
<tr>
<tdcolspan="5"align="center"class="tright">
<h2>
<xsl:numbervalue="position()"format="一、"/><xsl:value-ofselect="@title"/>
</h2>
</td>
</tr>
<xsl:apply-templatesselect="items"/>
</TABLE>
<BR/>
</xsl:template>
<>
<xsl:templatematch="items">
<tr>
<tdcolspan="2"class="tright">
<xsl:numbervalue="position()"format="1."/><xsl:value-ofselect="@title"/>
</td>
<xsl:choose>
<xsl:whentest="@isTrunk[.='false']">
<xsl:apply-templatesselect="result"/>
<xsl:apply-templatesselect="officer"/>
</xsl:when>
<xsl:otherwise>
<tdcolspan="3"class="tright">
注意以下几点
</td>
<xsl:apply-templatesselect="item"/>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:template>
<>
<xsl:templatematch="item">
<tr>
<tdclass="tright"colspan="2">
<h4><xsl:numbervalue="position()"format="(a)."/><xsl:value-ofselect="@title"/></h4>
</td>
<xsl:apply-templatesselect="result"/>
<xsl:apply-templatesselect="officer"/>
</tr>
</xsl:template>
<>
<xsl:templatematch="result">
<xsl:choose>
<xsl:whentest="@type='1'">
<tdwidth="15%">
<xsl:elementname="select">
<xsl:attributename="name">re_<xsl:value-ofselect="../@id"/></xsl:attribute>
<>
<xsl:choose>
<xsl:whentest=".='0'">
<optionvalue="0"selected="selected">请选择</option>
<optionvalue="1">符合</option>
<optionvalue="2">基本符合</option>
<optionvalue="3">不符合</option>
</xsl:when>
<xsl:whentest=".='1'">
<optionvalue="0">请选择</option>
<optionvalue="1"selected="selected">符合</option>
<optionvalue="2">基本符合</option>
<optionvalue="3">不符合</option>
</xsl:when>
<xsl:whentest=".='2'">
<optionvalue="0">请选择</option>
<optionvalue="1">符合</option>
<optionvalue="2"selected="selected">基本符合</option>
<optionvalue="3">不符合</option>
</xsl:when>
<xsl:whentest=".='3'">
<optionvalue="0">请选择</option>
<optionvalue="1">符合</option>
<optionvalue="2">基本符合</option>
<optionvalue="3"selected="selected">不符合</option>
</xsl:when>
</xsl:choose>
<>
</xsl:element>
</td>
</xsl:when>
<xsl:whentest="@type='2'">
<tdwidth="15%">
<xsl:elementname="select">
<xsl:attributename="name">re_<xsl:value-ofselect="../@id"/></xsl:attribute>
<xsl:choose>
<xsl:whentest=".='0'">
<optionvalue="0"selected="selected">请选择</option>
<optionvalue="1">是</option>
<optionvalue="2">否</option>
</xsl:when>
<xsl:whentest=".='1'">
<optionvalue="0">请选择</option>
<optionvalue="1"selected="selected">是</option>
<optionvalue="2">否</option>
</xsl:when>
<xsl:whentest=".='3'">
<optionvalue="0">请选择</option>
<optionvalue="1">是</option>
<optionvalue="2"selected="selected">否</option>
</xsl:when>
</xsl:choose>
</xsl:element>
</td>
</xsl:when>
<xsl:whentest="@type='3'">
<tdwidth="15%">
<xsl:elementname="select">
<xsl:attributename="name">re_<xsl:value-ofselect="../@id"/></xsl:attribute>
<xsl:choose>
<xsl:whentest=".='0'">
<optionvalue="0"selected="selected">请选择</option>
<optionvalue="1">有</option>
<optionvalue="2">无</option>
</xsl:when>
<xsl:whentest=".='1'">
<optionvalue="0">请选择</option>
<optionvalue="1"selected="selected">有</option>
<optionvalue="2">无</option>
</xsl:when>
<xsl:whentest=".='3'">
<optionvalue="0">请选择</option>
<optionvalue="1">有</option>
<optionvalue="2"selected="selected">无</option>
</xsl:when>
</xsl:choose>
</xsl:element>
</td>
</xsl:when>
<xsl:otherwise>
<tdwidth="15%">
<xsl:elementname="textarea">
<xsl:attributename="name">re_<xsl:value-ofselect="../@id"/></xsl:attribute><xsl:value-ofselect="."/>
</xsl:element>
<xsl:value-ofselect="@units"/>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<>
<xsl:templatematch="officer">
<tdwidth="9%"class="tright">责任人</td>
<tdwidth="11%">
<xsl:elementname="textarea">
<xsl:attributename="name">of_<xsl:value-ofselect="../@id"/></xsl:attribute>
<xsl:value-ofselect="."/>
</xsl:element>
</td>
</xsl:template>
</xsl:stylesheet>
当前1/2页12下一页阅读全文