xsl传参,设置全局变量,并实现目录内容联动

wylc123 1年前 ⋅ 893 阅读

1. 设置目标

1)xsl模板中设置全局变量,变量值取xml里的值

2)实现目录内容联动,锚点的href和内容的id带相同的前缀(全局变量传来的)

2. 实现目标

2.1 全局变量

所谓全局,因为xsl:variable元素是xsl:stylesheet的子无素,所以在stylesheet 中定义的变量可以在整个实例空间中引用.所有全局变量要写在xsl:variable元素里面。类似:

<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:param name="viewtype" select="'view'"/>
 <xsl:variable name="URLVariable">
 <xsl:choose>
  <xsl:when test="contains($viewtype,'edit')">  
    <xsl:text>/flowEngine/page1.wml</xsl:text>
  </xsl:when>
   <xsl:when test="contains($viewtype,'view')">  
   <xsl:text>/flowEngine/page2.wml</xsl:text>
  </xsl:when>
   <xsl:otherwise>
   <xsl:text>/flowEngine/error.wml</xsl:text>   
   </xsl:otherwise>
 </xsl:choose>
</xsl:variable>
</xsl:stylesheet >

通过xsl:parm元素从xml获取变量值,实现全局变量的动态变化。

2.2 使用设置的全局变量

 1.$vairableName的方法
  对于<xsl:value-of select ="$vairableName"/>之类以node对象为值的元素,请使用之.
  但<xsl:text>$hyperURLVariable</xsl:text>是无效的.
 2.{$vairableName}的方法
  对于一些以非node对象为值的引用,请使用{$vairableName},两边的大括号不能少.
  如 <a href="{$hyperURLVariable}"  > myURL</a>
  但<xsl:text>{$hyperURLVariable}</xsl:text>也是无效的.

2.3 锚点实现目录内容联动

原理:目录的<a href="#id"></a>,href属性#后面跟上内容的id就能实现定位跳转的目的,实现目录内容联动效果。

2.3.1 解析xml生成目录

xsl模板代码:

<xsl:template match="section/title" mode="menu">
    <a class="text-ellipsis">
      <xsl:attribute name="href">
        <xsl:value-of select="concat('#',$global_prefixes_for_anchor,'_',../@id)"/>
      </xsl:attribute>
      <xsl:value-of select="current()"/>
    </a>
  </xsl:template>

解析标题的id,拼接#f符号全局变量和标题id,赋值给目录的href。

2.3.2 解析获取章节的标题
<!--节 开始-->
  <xsl:template match="section" mode="article">
    <div role="section" class="section">
      <xsl:apply-templates mode="article"/>
    </div>
  </xsl:template>

  <xsl:template match="section/title" mode="article">
    <h4>
      <a>
        <xsl:attribute name="name">
          <xsl:value-of select="concat($global_prefixes_for_anchor,'_',../@id)"/>
        </xsl:attribute>
        <xsl:value-of select="."/>
      </a>
    </h4>
  </xsl:template>
  <!--节 结束-->

3. 完整例子

3.1 xml内容
<?xml version="1.0" encoding="utf-8" standalone="no"?><article id="5" type="journal" filename="NFLJ202005003">
	<global_prefixes_for_anchor>xxxxxx</global_prefixes_for_anchor>
	<title>拖拉机节能减排问题分析及解决措施研究——以江西省拖拉机市场为研究对象</title>
	<prolog>
		<authormeta><authorinformation id="36"><personinfo>
<namedetails>
<fullname>张志强</fullname><firstname>志强</firstname><lastname>张</lastname>
</namedetails>
<authorintro>张志强(1990—),男,江西南昌人,硕士研究生,工程师,研究方向:农业机械。</authorintro>
</personinfo>
<organizationinfo>
<namedetails>
<organizationname>江西省农业机械化技术推广监测站</organizationname>
</namedetails>
<addressdetails><locality><postcode>330044</postcode>
<address>江西南昌</address>
</locality></addressdetails>
</organizationinfo>
</authorinformation><authorinformation id="37"><personinfo>
<namedetails>
<fullname>吕春林</fullname><firstname>春林</firstname><lastname>吕</lastname>
</namedetails>
</personinfo>
<organizationinfo>
<namedetails>
<organizationname>江西省农业机械化技术推广监测站</organizationname>
</namedetails>
<addressdetails><locality><postcode>330044</postcode>
<address>江西南昌</address>
</locality></addressdetails>
</organizationinfo>
</authorinformation><authorinformation id="38"><personinfo>
<namedetails>
<fullname>罗俊勇</fullname><firstname>俊勇</firstname><lastname>罗</lastname>
</namedetails>
</personinfo>
<organizationinfo>
<namedetails>
<organizationname>江西省农业机械化技术推广监测站</organizationname>
</namedetails>
<addressdetails><locality><postcode>330044</postcode>
<address>江西南昌</address>
</locality></addressdetails>
</organizationinfo>
</authorinformation><authorinformation id="39"><personinfo>
<namedetails>
<fullname>曹响才</fullname><firstname>响才</firstname><lastname>曹</lastname>
</namedetails>
</personinfo>
<organizationinfo>
<namedetails>
<organizationname>江西省农业机械化技术推广监测站</organizationname>
</namedetails>
<addressdetails><locality><postcode>330044</postcode>
<address>江西南昌</address>
</locality></addressdetails>
</organizationinfo>
</authorinformation></authormeta>
		<sourcemeta><sourceinfo id="NFLJ202005"><sourcetitle>南方农机</sourcetitle><sourcetitle xml:lang="en">China Southern Agricultural Machinery</sourcetitle></sourceinfo><cn>36-1239/TH</cn><issn>1672-3872</issn><year>2020</year><issue>05</issue><volume>51</volume><articleloc><pagenum>1-6</pagenum><page>7-12</page><column>调查研究</column></articleloc></sourcemeta>
		<metadata><articleid>1672-3872(2020)05-0001-02</articleid><articletype>A</articletype><category>S219</category><keywords><keyword>拖拉机</keyword><keyword>能耗</keyword><keyword>排放</keyword><keyword>节能减排措施</keyword></keywords></metadata>
	</prolog>
	<body>
<p id="1">拖拉机属于动力型农业机械,在农业运输和生产环节替代人力进行移动作业。随着农业机械化水平的不断提高,拖拉机已经成为农民进行农业生产重要的日常机具,而拖拉机由于需要较大动力进行农业作业,动力方面使用柴油发动机,柴油发动机的碳颗粒物排放量较大,因此对拖拉机的节能减排措施进行研究,能有效的促进农业生产过程中能源消耗和污染物排放量的降低,同时也能为拖拉机的转型升级提供一定的指导意义<citation id="31" type="reference"><link href="21" rel="bibliography"/><sup>[1]</sup></citation>。</p><section id="2" level="1">
<title>1 目前存在的问题</title>
<subsection id="3" level="2">
<title>1.1 小型拖拉机保有量占比较大</title>
<p id="4">自20世纪70年代,我国实施农村土地家庭联产承包责任制以来,土地的分散化经营一直是农业生产的主要方式。小型拖拉机小巧、轻便、适用性强,十分有利于小规模作业,在农业生产中一直发挥着重要作用。江西省统计年鉴数据显示,截止2018年底,全省大中型拖拉机保有量为38400台,总动力188.69万千瓦,小型拖拉机保有量为340700台,总动力373.17万千瓦,大中型拖拉机保有量占比为18.8%,总动力占比为33.58%,小型拖拉机保有量占比为81.2%,总动力占比为66.42%,小型拖拉机是全省拖拉机的主流机型。但另一方面,与大中型拖拉机相比,小型拖拉机存在作业效率较低,能耗和污染物排放量较高等问题,随着农业机械的转型升级,小型拖拉机的劣势日益凸显。</p></subsection>
<subsection id="5" level="2">
<title>1.2 国二排放标准拖拉机存量较大</title>
<p id="6">根据2014年10月1日正式实施的《非道路移动机械用柴油机排气污染物排放限值及测量方法(中国第三、四阶段)》标准中规定“自2016年4月1日起,停止制造、进口和销售装用第二阶段柴油机的非道路移动机械,所有制造、进口和销售的非道路移动机械应装用符合本标准第三阶段要求的柴油机”。因此,2016年之前的拖拉机大部分是执行第二阶段排放标准要求,同时还存在少量执行第一阶段排放标准要求的拖拉机。</p><p id="7">据江西省农业机械统计数据显示,2018年全省拖拉机市场保有量379100台,2016年、2017年、2018年新增农机购置补贴拖拉机数量为45982台。因此,当前正在使用的拖拉机市场中,2016年之前购置的拖拉机数量为333118台,约占整个拖拉机保有量的87%。</p></subsection>
<subsection id="8" level="2">
<title>1.3 拖拉机维护保养欠缺</title>
<p id="9">拖拉机在进行日常生产作业后,由于作业环境恶劣,不可避免的会造成零部件的磨损,连接件、密封胶的松动和润滑油、冷却液损耗等问题,长时间使用而不进行定期正确的保养,会造成拖拉机工况的恶化。在实际拖拉机保养过程中存在着只更换润滑油,不重视零部件的紧固和密封性的检查维护,不按技术条件需定期进行清洗、检查、润滑、调整、坚固,更换部份易损零件,甚至还有一些不进行定期保养的现象,都会影响拖拉机的作业效率和能源消耗。例如空气滤清器横截面堵塞1/3,油耗将提高近2%;如喷油角度较规定提前3°~4°,耗油量增加近2%;气门间隙大或小,都会影响充气量,其中气门间隙过大,油耗会增加近20%<citation id="32" type="reference"><link href="23" rel="bibliography"/><sup>[2]</sup></citation>。</p></subsection>
<subsection id="10" level="2">
<title>1.4 拖拉机驾驶不规范</title>
<p id="11">在实际农业生产使用过程中,拖拉机操作人员大多数没有节能的理念,大脚踩油门、长时间超负荷运行、“大马力拉小车”、档位和速度不匹配、轮胎气压不足等缺乏规范性的操作时有发生,对拖拉机的有效运行造成了较大的影响,增加了不必要的能耗,同时也降低了拖拉机的使用寿命。例如要提高到同样的速度,猛加油门比缓加油门更加费油,更加剧磨损,一次猛加和缓加到同样的速度,油耗相差可达12毫升;低档高速行驶往往使油耗超过正常值的45%<citation id="33" type="reference"><link href="25" rel="bibliography"/><sup>[3]</sup></citation>。</p></subsection>
</section>
<section id="12" level="1">
<title>2 节能减排措施</title>
<subsection id="13" level="2">
<title>2.1 加快推进土地集约化,促进拖拉机市场结构调整</title>
<p id="14">大中型拖拉机在实际作业过程中可以大大地提高生产效率以及机械的使用率,对于同一面积的生产用地进行耕地时,应用大中型拖拉机消耗的能源远远少于小型拖拉机,如果生产的面积更大,进行一些深耕工作时,大中型拖拉机还可以表现出更加明显的节能效果。随着我国农村土地流转政策的实施,改变土地经营现状,科学整合土地流转成为了发展现代农业经济的必由之路<citation id="34" type="reference"><link href="27" rel="bibliography"/><sup>[4]</sup></citation>。同时,加快推进全省农村土地的规模化、集约化经营,有利于大中型拖拉机的普及使用。</p></subsection>
<subsection id="15" level="2">
<title>2.2 加强宣传培训,提升农民节能减排意识和技术水平</title>
<p id="16">针对农民群众、农机操作人员、农机维修人员开展节能减排宣传和相关技术培训,不断提高人们的节能减排意识和节能减排技术水平。一是通过积极的宣传与普及环保节能知识,帮助农民认识到拖拉机高能耗所引发的浪费能源等重大问题;二是开展拖拉机操作水平提升培训,使农民规范操作,从使用拖拉机的各个阶段实现节能减排<citation id="35" type="reference"><link href="29" rel="bibliography"/><sup>[5]</sup></citation>;三是在农村设立农业机械专业服务站,通过专业技术人员为农民解决拖拉机的各种问题。</p></subsection>
<subsection id="17" level="2">
<title>2.3 推广应用节能型机型,从源头降低能耗和排放问题</title>
<p id="18">解决农业机械高能耗问题的关键是研发与推广节能减排新技术、新机型,从源头降低拖拉机的能耗和污染物排放问题。提供创新合作平台,促进产学研三类机构合作,结合江西省农业产业现状,针对适宜拖拉机机型进行节能减排技术创新研发;通过政策引导,提升农机合作社、种植大户对节能减排机型的购买意愿;针对新型节能减排型拖拉机进行应用推广示范,用实际效果提升此类机型的市场占有率。</p></subsection>
</section>
<section id="19" level="1">
<title>3 总结</title>
<p id="20">拖拉机在农业生产中发挥着不可替代的作用,是保障粮食生产的重要农业机械,而随着农业机械化的发展,拖拉机现有市场保有量越来越大。本文通过对江西省拖拉机结构和使用过程中存在的问题进行分析,提出了相应的节能减排措施,对拖拉机的节能减排具有一定的意义,同时也有利于加速拖拉机市场的结构调整和转型升级,促进拖拉机市场从量的增长转向质的提高。</p></section>
</body>
	<bibliography>
<biblioitem id="21">
<title>[1]宋万军.探究我国农业机械能耗现状分析及节能减排技术[J].南方农业,2019,13(17):152-153.</title>
<title xml:lang="en"></title>
</biblioitem>
<biblioitem id="23">
<title>[2]李凯.大型拖拉机的维护保养分析[J].农家科技:中旬刊,2019(4):153.</title>
<title xml:lang="en"></title>
</biblioitem>
<biblioitem id="25">
<title>[3]陈乔关.浅谈拖拉机驾驶节油措施[J].农家科技旬刊,2015(4):135-136.</title>
<title xml:lang="en"></title>
</biblioitem>
<biblioitem id="27">
<title>[4]朱立艳.关于农村土地流转对农业经济的影响[J].农家科技(下旬刊),2019(2):223.</title>
<title xml:lang="en"></title>
</biblioitem>
<biblioitem id="29">
<title>[5]唐军.康平县农业机械能耗现状与节能减排措施[J].农业科技与装备,2012(11):91-92.</title>
<title xml:lang="en"></title>
</biblioitem>
</bibliography>	
<abstract>随着我国农业机械化水平的不断提升,农业机械对环境的污染问题引起了人们的普遍关注。本文以江西省拖拉机市场为研究对象,针对全省拖拉机结构类型和日常使用过程中存在的问题进行分析,有针对性的提出了相应的节能减排措施,有助于减少拖拉机能源消耗和污染物排放,仅供参考。</abstract></article>
3.2 目录解析xsl模板内容
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" indent="no"/>
  <xsl:variable name="global_prefixes_for_anchor">
    <xsl:value-of select="//global_prefixes_for_anchor"></xsl:value-of>
  </xsl:variable>
  <xsl:attribute-set name="tableAttrs">
    <xsl:attribute name="colspan">
      <xsl:value-of select="."/>
    </xsl:attribute>
    <xsl:attribute name="rowspan">
      <xsl:value-of select="."/>
    </xsl:attribute>
    <xsl:attribute name="width">
      <xsl:value-of select="."/>
    </xsl:attribute>
    <xsl:attribute name="height">
      <xsl:value-of select="."/>
    </xsl:attribute>
  </xsl:attribute-set>

  <xsl:template match="/">
    <xsl:apply-templates select="/article/body/section" mode="menu"/>
  </xsl:template>

  <xsl:template match="*" mode="menu">
  </xsl:template>

  <!--菜单 开始-->
  <xsl:template match="part" mode="menu">
    <xsl:apply-templates select="title"  mode="menu"/>
    <ul class="chapter">
      <xsl:apply-templates select="chapter" mode="menu"/>
    </ul>
  </xsl:template>

  <xsl:template match="part/title" mode="menu">
    <h3 class="leftNav-t1 text-ellipsis">
      <a>
        <xsl:attribute name="href">
          <xsl:value-of select="concat('#',$global_prefixes_for_anchor,'_',../@id)"/>
        </xsl:attribute>
        <xsl:value-of select="current()"/>
      </a>
    </h3>
  </xsl:template>

  <xsl:template match="part/chapter" mode="menu">
    <li class="text-ellipsis">
      <xsl:apply-templates select="title" mode="menu"/>
      <ul class="chapter">
        <xsl:apply-templates select="section" mode="menu"/>
      </ul>
    </li>
  </xsl:template>

  <xsl:template match="chapter/title" mode="menu">
    <a class="text-ellipsis">
      <xsl:attribute name="href">
        <xsl:value-of select="concat('#',$global_prefixes_for_anchor,'_',../@id)"/>
      </xsl:attribute>
      <xsl:value-of select="current()"/>
    </a>
  </xsl:template>

  <xsl:template match="section" mode="menu">
    <li class="text-ellipsis">
      <xsl:apply-templates select="title" mode="menu"/>
      <ul class="chapter">
        <xsl:apply-templates select="section" mode="menu"/>
		<xsl:apply-templates select="subsection" mode="menu"/>
      </ul>
    </li>
  </xsl:template>

  <xsl:template match="section/title" mode="menu">
    <a class="text-ellipsis">
      <xsl:attribute name="href">
        <xsl:value-of select="concat('#',$global_prefixes_for_anchor,'_',../@id)"/>
      </xsl:attribute>
      <xsl:value-of select="current()"/>
    </a>
  </xsl:template>
  
  <xsl:template match="subsection" mode="menu">
    <li class="text-ellipsis">
      <xsl:apply-templates select="title" mode="menu"/>
      <ul class="chapter">
        <xsl:apply-templates select="subsection" mode="menu"/>
      </ul>
    </li>
  </xsl:template>

  <xsl:template match="subsection/title" mode="menu">
    <a class="text-ellipsis">
      <xsl:attribute name="href">
        <xsl:value-of select="concat('#',$global_prefixes_for_anchor,'_',../@id)"/>
      </xsl:attribute>
      <xsl:value-of select="current()"/>
    </a>
  </xsl:template>
  <!--菜单 结束-->
</xsl:stylesheet>
3.3 内容解析xsl模板内容
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" indent="no" version="1.0" encoding="utf-8" standalone="yes"/>
  <xsl:variable name="global_prefixes_for_anchor">
    <xsl:value-of select="//global_prefixes_for_anchor"></xsl:value-of>
  </xsl:variable>
  <xsl:attribute-set name="tableAttrs">
    <xsl:attribute name="colspan">
      <xsl:value-of select="."/>
    </xsl:attribute>
    <xsl:attribute name="rowspan">
      <xsl:value-of select="."/>
    </xsl:attribute>
    <xsl:attribute name="width">
      <xsl:value-of select="."/>
    </xsl:attribute>
    <xsl:attribute name="height">
      <xsl:value-of select="."/>
    </xsl:attribute>
  </xsl:attribute-set>

  <xsl:attribute-set name="mediaAttrs">
    <xsl:attribute name="src">
      <xsl:value-of select="."/>
    </xsl:attribute>
    <xsl:attribute name="width">
      <xsl:value-of select="."/>
    </xsl:attribute>
    <xsl:attribute name="height">
      <xsl:value-of select="."/>
    </xsl:attribute>
  </xsl:attribute-set>

  <xsl:template match="/">
    <div role="article" class="article">
      <xsl:apply-templates />
    </div>
  </xsl:template>

  <!--文本元素 开始-->
  <xsl:template match="subscript">
    <sub role="subscript" class="subscript">
      <xsl:apply-templates />
    </sub>
  </xsl:template>

  <xsl:template match="supscript">
    <sup role="supscript" class="supscript">
      <xsl:apply-templates />
    </sup>
  </xsl:template>

  <xsl:template match="underline">
    <u role="underline" class="underline">
      <xsl:apply-templates />
    </u>
  </xsl:template>

  <xsl:template match="italic">
    <em role="italic" class="italic">
      <xsl:apply-templates />
    </em>
  </xsl:template>

  <xsl:template match="bold">
    <strong role="strong" class="strong">
      <xsl:apply-templates />
    </strong>
  </xsl:template>

  <xsl:template match="del">
    <del role="del" class="del">
      <xsl:apply-templates />
    </del>
  </xsl:template>

  <xsl:template match="ins">
    <ins role="ins" class="ins">
      <xsl:apply-templates />
    </ins>
  </xsl:template>

  <xsl:template match="a">
    <a>
      <xsl:attribute name="href">
        <xsl:value-of select="@href"/>
      </xsl:attribute>
      <xsl:apply-templates />
    </a>
  </xsl:template>
  <!--上标-->
  <xsl:template match="subscript">
    <sub>
      <xsl:apply-templates/>
    </sub>
  </xsl:template>
  <!--下标-->
  <xsl:template match="superscript">
    <sup>
      <xsl:attribute name="contenteditable">
        <xsl:value-of select="@contenteditable"/>
      </xsl:attribute>
      <xsl:attribute name="data-quote">
        <xsl:value-of select="@data-quote"/>
      </xsl:attribute>
      <xsl:apply-templates/>
    </sup>
  </xsl:template>

  <xsl:template match="ol">
    <xsl:copy>
      <xsl:attribute name="class">
        <xsl:value-of select="@class"/>
      </xsl:attribute>
      <xsl:attribute name="style">
        <xsl:value-of select="@style"/>
      </xsl:attribute>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="ul">
    <xsl:copy>
      <xsl:attribute name="class">
        <xsl:value-of select="@class"/>
      </xsl:attribute>
      <xsl:attribute name="style">
        <xsl:value-of select="@style"/>
      </xsl:attribute>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="li">
    <xsl:copy>
      <xsl:attribute name="class">
        <xsl:value-of select="@class"/>
      </xsl:attribute>
      <xsl:attribute name="style">
        <xsl:value-of select="@style"/>
      </xsl:attribute>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
  <!--文本元素 结束-->
  <xsl:template match="/">
    <xsl:apply-templates select="article/title" mode="title"/>
    <div class="prolog">
      <xsl:apply-templates select="/article/prolog" mode="prolog"/>
      <xsl:apply-templates select="article/abstract" mode="prolog"/>
    </div>
    <div id="gallery" class="clearfix">
      <div class="detail-con detail-con1" id="rightContent">
        <xsl:apply-templates select="/article/body" mode="article"/>
        <xsl:apply-templates select="/article/bibliography" mode="bibliography"/>
      </div>
    </div>
  </xsl:template>



  <!-- 标题 开始 -->
  <xsl:template match="article/title" mode="title">
    <xsl:if test="not(@xml:lang='en')">
      <center>
        <h1 role="title" class="title">
          <xsl:apply-templates />
        </h1>
      </center>
    </xsl:if>
  </xsl:template>
  <!-- 标题 结束 -->

  <!-- 简介 开始 -->
  <xsl:template match="prolog" mode="prolog">
    <div>
      <!--作者简介-->
      <div class="data">
        <!--作者导师-->
        <xsl:for-each select="authorinformation">
          <!--<xsl:if test="role='作者'">-->
          <div>
            <xsl:if test="role!=''">
              <span><xsl:value-of select="role" />:</span>
            </xsl:if>
            <span><xsl:value-of select="personinfo/namedetails/personname/fullname" />;</span>
            <span><xsl:value-of select="organizationinfo/namedetails/organizationnamedetails/organizationname" /></span>
          </div>
          <!--</xsl:if>-->
        </xsl:for-each>
        <xsl:if test="authormeta!=''">
          <span>作者:</span>
          <xsl:for-each select="authormeta/authorinformation/personinfo">
            <xsl:choose>
              <xsl:when test="authorintro">
                <span><xsl:value-of select="authorintro" /></span>
              </xsl:when>
              <xsl:otherwise>
                <span><xsl:value-of select="namedetails/fullname" />;</span>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:for-each>
          <!--古文-->
          <xsl:if test="authormeta/personinfo/fullname!=''">
            <span><xsl:value-of select="authormeta/personinfo/fullname" /></span>
          </xsl:if>
        </xsl:if>
        <xsl:if test="degreeinformation!=''">
          <span class="keys">作者简介:</span>
          <span><xsl:value-of select="degreeinformation/year" />年,</span>
          <span><xsl:value-of select="degreeinformation/organizationinfo/namedetails/organizationnamedetails/organizationname" />,</span>
          <span><xsl:value-of select="degreeinformation/speciality" /></span>
          <span><xsl:value-of select="degreeinformation/level" /></span>
        </xsl:if>
        <br/>
        <!--出版-->
        <xsl:if test="//sourcemeta"><xsl:for-each select="//sourcetitle[not(.=following::sourcetitle)]">
          <xsl:variable name="thesku" select="."/>
          <xsl:if test="not(@xml:lang)">
            <span class="keys">出版:</span>
            <span><xsl:value-of select="." /></span>
          </xsl:if>
        </xsl:for-each>
          <br/>
          <xsl:if test="//sourcemeta/cn!=''">
            <span class="keys">刊号:</span>
            <span><xsl:value-of select="//sourcemeta/cn" /></span>
            <br/>
          </xsl:if>

          <xsl:if test="//sourcemeta/issn!=''">
            <span class="keys">issn:</span>
            <span><xsl:value-of select="//sourcemeta/issn" /></span>
            <br/>
          </xsl:if>
        </xsl:if>

        <xsl:if test="//metadata/category!=''">
          <span class="keys">分类号:</span>
          <span><xsl:value-of select="//metadata/category" /></span>
          <br/>
        </xsl:if>
        <!--摘要-->
        <xsl:if test="article/abstract!=''">
          <span class="keys">摘要:</span>
          <xsl:for-each select="article/abstract">
            <xsl:if test="not(@xml:lang='en')">
              <xsl:apply-templates select="."/>
            </xsl:if>
          </xsl:for-each>
          <br/><br/>
        </xsl:if>
        <!--关键词-->
        <xsl:if test="//metadata/keywords!=''">
          <span class="keys">关键词:</span>
          <xsl:for-each select="//metadata/keywords/keyword">
            <xsl:if test="not(@xml:lang='en' or ../@xml:lang='en')">
              <span><xsl:value-of select="." />;</span>
            </xsl:if>
          </xsl:for-each>
          <br/>
        </xsl:if>
      </div>
    </div>
  </xsl:template>
  <!--古文作者简介-->
  <xsl:template match="article/abstract" mode="prolog">
    <xsl:if test="not(@xml:lang='en')">
      <span class="keys">摘要:</span>
      <span>
        <xsl:apply-templates />
      </span>
      <br/><br/>
    </xsl:if>
  </xsl:template>
  <!-- 简介 结束 -->

  <!--正文 开始-->

  <!--章 开始-->
  <xsl:template match="part" mode="article">
    <div role="part" class="part">
      <xsl:apply-templates />
    </div>
  </xsl:template>

  <xsl:template match="part/title" mode="article">
    <h2 role="title" class="title">
      <a>
        <xsl:attribute name="name">
          <xsl:value-of select="concat($global_prefixes_for_anchor,../@id)"/>
        </xsl:attribute>
        <xsl:value-of select="."/>
      </a>
    </h2>
  </xsl:template>
  <!--章 结束-->

  <xsl:template match="para" mode="article">
    <xsl:choose>
      <xsl:when test="mediaobject">
        <p style="text-align:center">
          <xsl:apply-templates mode="article"/>
        </p>
      </xsl:when>
      <xsl:otherwise>
        <p>
          <xsl:apply-templates mode="article"/>
        </p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>



  <xsl:template match="span" mode="article">
    <xsl:apply-templates mode="article"/>
  </xsl:template>

  <!--章 开始-->
  <xsl:template match="chapter" mode="article">
    <div role="chapter" class="chapter">
      <xsl:apply-templates />
    </div>
  </xsl:template>

  <xsl:template match="chapter/title" mode="article">
    <h3 role="title" class="title">
      <a>
        <xsl:attribute name="name">
          <xsl:value-of select="concat($global_prefixes_for_anchor,../@id)"/>
        </xsl:attribute>
        <xsl:value-of select="."/>
      </a>
    </h3>
  </xsl:template>
  <!--章 结束-->

  <!--节 开始-->
  <xsl:template match="section" mode="article">
    <div role="section" class="section">
      <xsl:apply-templates mode="article"/>
    </div>
  </xsl:template>

  <xsl:template match="section/title" mode="article">
    <h4>
      <a>
        <xsl:attribute name="name">
          <xsl:value-of select="concat($global_prefixes_for_anchor,'_',../@id)"/>
        </xsl:attribute>
        <xsl:value-of select="."/>
      </a>
    </h4>
  </xsl:template>
  <!--节 结束-->

  <!--节 开始-->
  <xsl:template match="subsection" mode="article">
    <div role="subsection" class="subsection">
      <xsl:apply-templates  mode="article"/>
    </div>
  </xsl:template>

  <xsl:template match="subsection/title" mode="article">
    <h5>
      <a>
        <xsl:attribute name="name">
          <xsl:value-of select="concat($global_prefixes_for_anchor,'_',../@id)"/>
        </xsl:attribute>
        <xsl:value-of select="."/>
      </a>
    </h5>
  </xsl:template>

  <!--保留span标签中的样式-->
  <xsl:template match="span" mode="article">
    <span>
      <xsl:attribute name="style">
        <xsl:value-of select="@style"/>
      </xsl:attribute>
      <xsl:apply-templates mode="article"/>
    </span>
  </xsl:template>
  <!--保留span标签中的样式-->

  <!--保留p标签-->
  <xsl:template match="p" mode="article">
    <p>
      <xsl:attribute name="id">
        <xsl:value-of select="@id"/>
      </xsl:attribute>
      <xsl:apply-templates mode="article"/>
    </p>
  </xsl:template>
  <!--保留p标签-->

  <!--节 结束-->
  <!--正文 结束-->
  <!--图片 开始-->
  <xsl:template match="mediaobject" mode="article">
    <a>
      <xsl:attribute name="name">
        <xsl:value-of select="../@id"/>
      </xsl:attribute>
    </a>
    <xsl:apply-templates mode="article"/>
  </xsl:template>
  <xsl:template match="imageobject" mode="article">
    <img>
      <xsl:attribute name="src">
        <xsl:value-of select="concat('http://192.168.103.90:8088/getfile/index?filename=',./imagedata/@fileref)"/>
      </xsl:attribute>
      <xsl:attribute name="title">
        <xsl:apply-templates select="./imagedata/@title"/>
      </xsl:attribute>
      <xsl:attribute name="width">
        <xsl:value-of select="./imagedata/@width"/>
      </xsl:attribute>
      <xsl:attribute name="height">
        <xsl:value-of select="./imagedata/@height"/>
      </xsl:attribute>
      <xsl:attribute name="nid">
        <xsl:value-of select="./imagedata/@nid"/>
      </xsl:attribute>
      <xsl:attribute name="data-note">
        <xsl:value-of select="./imagedata/@data-note"/>
      </xsl:attribute>
      <xsl:attribute name="data_source">
        <xsl:value-of select="./imagedata/@data_source"/>
      </xsl:attribute>
      <xsl:attribute name="style">
        <xsl:value-of select="./imagedata/@style"/>
      </xsl:attribute>
      <xsl:attribute name="data-math">
        <xsl:value-of select="./imagedata/@data-math"/>
      </xsl:attribute>
    </img>
  </xsl:template>

  <xsl:template match="figure" mode="article">
    <div align="center">
      <img>
        <xsl:attribute name="src">
          <xsl:value-of  select="concat('http://192.168.103.90:8088/getfile/index?filename=',substring(./image/@href,8))" />
        </xsl:attribute>
        <xsl:attribute name="title">
          <xsl:apply-templates select="title"/>
        </xsl:attribute>
        <xsl:attribute name="alt">
          <xsl:apply-templates select="image/alt"/>
        </xsl:attribute>
        <xsl:if test="./image/@width">
          <xsl:attribute name="width">
            <xsl:value-of select="./image/@width"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:if test="./image/@height">
          <xsl:attribute name="height">
            <xsl:value-of select="./image/@height"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:if test="./image/@style">
          <xsl:attribute name="style">
            <xsl:value-of select="./image/@style"/>
          </xsl:attribute>
        </xsl:if>
      </img>
    </div>
  </xsl:template>
  <!--图片 结束-->

  <!--表格 开始-->
  <xsl:template match="table" mode="article">
    <div class="table-wrapper">
      <a>
        <xsl:attribute name="name">
          <xsl:value-of select="@id"/>
        </xsl:attribute>
      </a>
      <table role="table" class="table table-bordered">
        <xsl:apply-templates mode="article"/>
      </table>
    </div>
  </xsl:template>

  <xsl:template match="table//thead" mode="article">
    <thead>
      <xsl:apply-templates mode="article"/>
    </thead>
  </xsl:template>

  <xsl:template match="table//tbody" mode="article">
    <tbody>
      <xsl:apply-templates mode="article"/>
    </tbody>
  </xsl:template>

  <xsl:template match="table//tfoot" mode="article">
    <tfoot>
      <xsl:apply-templates mode="article"/>
    </tfoot>
  </xsl:template>

  <xsl:template match="table//tr" mode="article">
    <tr>
      <xsl:apply-templates mode="article"/>
    </tr>
  </xsl:template>

  <xsl:template match="table//th" mode="article">
    <th>
      <xsl:apply-templates mode="article"/>
    </th>
  </xsl:template>

  <xsl:template match="table//td" mode="article">
    <td>
      <xsl:apply-templates select="@* | node()" mode="article"/>
    </td>
  </xsl:template>

  <xsl:template match="table//caption" mode="article">
    <caption>
      <xsl:apply-templates mode="article"/>
    </caption>
  </xsl:template>

  <xsl:template match="table//@*" mode="article">
    <xsl:copy use-attribute-sets="tableAttrs" />
  </xsl:template>
  <!--表格 结束-->
  <!--处理引用 开始-->
  <xsl:template match="bibliography" mode="bibliography">
    <!--作者简介-->
    <div class="bibliography">
      <xsl:if test="biblioitem/title!=''">
        <h4>参考文献:</h4>
        <xsl:for-each select="biblioitem">
          <p>
            <xsl:value-of select="title" />
          </p>
        </xsl:for-each>
      </xsl:if>
    </div>
  </xsl:template>
  <!--处理引用 结束-->
</xsl:stylesheet>
3.4 解析结果
3.4.1 目录
<html>
 <head></head>
 <body>
  <li class="text-ellipsis"><a class="text-ellipsis" href="#xxxxxx_2">1 目前存在的问题</a>
   <ul class="chapter">
    <li class="text-ellipsis"><a class="text-ellipsis" href="#xxxxxx_3">1.1 小型拖拉机保有量占比较大</a>
     <ul class="chapter"></ul></li>
    <li class="text-ellipsis"><a class="text-ellipsis" href="#xxxxxx_5">1.2 国二排放标准拖拉机存量较大</a>
     <ul class="chapter"></ul></li>
    <li class="text-ellipsis"><a class="text-ellipsis" href="#xxxxxx_8">1.3 拖拉机维护保养欠缺</a>
     <ul class="chapter"></ul></li>
    <li class="text-ellipsis"><a class="text-ellipsis" href="#xxxxxx_10">1.4 拖拉机驾驶不规范</a>
     <ul class="chapter"></ul></li>
   </ul></li>
  <li class="text-ellipsis"><a class="text-ellipsis" href="#xxxxxx_12">2 节能减排措施</a>
   <ul class="chapter">
    <li class="text-ellipsis"><a class="text-ellipsis" href="#xxxxxx_13">2.1 加快推进土地集约化,促进拖拉机市场结构调整</a>
     <ul class="chapter"></ul></li>
    <li class="text-ellipsis"><a class="text-ellipsis" href="#xxxxxx_15">2.2 加强宣传培训,提升农民节能减排意识和技术水平</a>
     <ul class="chapter"></ul></li>
    <li class="text-ellipsis"><a class="text-ellipsis" href="#xxxxxx_17">2.3 推广应用节能型机型,从源头降低能耗和排放问题</a>
     <ul class="chapter"></ul></li>
   </ul></li>
  <li class="text-ellipsis"><a class="text-ellipsis" href="#xxxxxx_19">3 总结</a>
   <ul class="chapter"></ul></li>
 </body>
</html>
3.4.2 内容
<html>
 <head></head>
 <body>
  <center>
   <h1 role="title" class="title">拖拉机节能减排问题分析及解决措施研究——以江西省拖拉机市场为研究对象</h1>
  </center>
  <div class="prolog">
   <div>
    <div class="data">
     <span>作者:</span>
     <span>张志强(1990—),男,江西南昌人,硕士研究生,工程师,研究方向:农业机械。</span>
     <span>吕春林;</span>
     <span>罗俊勇;</span>
     <span>曹响才;</span>
     <br />
     <span class="keys">出版:</span>
     <span>南方农机</span>
     <br />
     <span class="keys">刊号:</span>
     <span>36-1239/TH</span>
     <br />
     <span class="keys">issn:</span>
     <span>1672-3872</span>
     <br />
     <span class="keys">分类号:</span>
     <span>S219</span>
     <br />
     <span class="keys">关键词:</span>
     <span>拖拉机;</span>
     <span>能耗;</span>
     <span>排放;</span>
     <span>节能减排措施;</span>
     <br />
    </div>
   </div>
   <span class="keys">摘要:</span>
   <span>随着我国农业机械化水平的不断提升,农业机械对环境的污染问题引起了人们的普遍关注。本文以江西省拖拉机市场为研究对象,针对全省拖拉机结构类型和日常使用过程中存在的问题进行分析,有针对性的提出了相应的节能减排措施,有助于减少拖拉机能源消耗和污染物排放,仅供参考。</span>
   <br />
   <br />
  </div>
  <div id="gallery" class="clearfix">
   <div class="detail-con detail-con1" id="rightContent"> 
    <p id="1">拖拉机属于动力型农业机械,在农业运输和生产环节替代人力进行移动作业。随着农业机械化水平的不断提高,拖拉机已经成为农民进行农业生产重要的日常机具,而拖拉机由于需要较大动力进行农业作业,动力方面使用柴油发动机,柴油发动机的碳颗粒物排放量较大,因此对拖拉机的节能减排措施进行研究,能有效的促进农业生产过程中能源消耗和污染物排放量的降低,同时也能为拖拉机的转型升级提供一定的指导意义[1]。</p>
    <div role="section" class="section"> 
     <h4><a name="xxxxxx_2">1 目前存在的问题</a></h4> 
     <div role="subsection" class="subsection"> 
      <h5><a name="xxxxxx_3">1.1 小型拖拉机保有量占比较大</a></h5> 
      <p id="4">自20世纪70年代,我国实施农村土地家庭联产承包责任制以来,土地的分散化经营一直是农业生产的主要方式。小型拖拉机小巧、轻便、适用性强,十分有利于小规模作业,在农业生产中一直发挥着重要作用。江西省统计年鉴数据显示,截止2018年底,全省大中型拖拉机保有量为38400台,总动力188.69万千瓦,小型拖拉机保有量为340700台,总动力373.17万千瓦,大中型拖拉机保有量占比为18.8%,总动力占比为33.58%,小型拖拉机保有量占比为81.2%,总动力占比为66.42%,小型拖拉机是全省拖拉机的主流机型。但另一方面,与大中型拖拉机相比,小型拖拉机存在作业效率较低,能耗和污染物排放量较高等问题,随着农业机械的转型升级,小型拖拉机的劣势日益凸显。</p>
     </div> 
     <div role="subsection" class="subsection"> 
      <h5><a name="xxxxxx_5">1.2 国二排放标准拖拉机存量较大</a></h5> 
      <p id="6">根据2014年10月1日正式实施的《非道路移动机械用柴油机排气污染物排放限值及测量方法(中国第三、四阶段)》标准中规定“自2016年4月1日起,停止制造、进口和销售装用第二阶段柴油机的非道路移动机械,所有制造、进口和销售的非道路移动机械应装用符合本标准第三阶段要求的柴油机”。因此,2016年之前的拖拉机大部分是执行第二阶段排放标准要求,同时还存在少量执行第一阶段排放标准要求的拖拉机。</p>
      <p id="7">据江西省农业机械统计数据显示,2018年全省拖拉机市场保有量379100台,2016年、2017年、2018年新增农机购置补贴拖拉机数量为45982台。因此,当前正在使用的拖拉机市场中,2016年之前购置的拖拉机数量为333118台,约占整个拖拉机保有量的87%。</p>
     </div> 
     <div role="subsection" class="subsection"> 
      <h5><a name="xxxxxx_8">1.3 拖拉机维护保养欠缺</a></h5> 
      <p id="9">拖拉机在进行日常生产作业后,由于作业环境恶劣,不可避免的会造成零部件的磨损,连接件、密封胶的松动和润滑油、冷却液损耗等问题,长时间使用而不进行定期正确的保养,会造成拖拉机工况的恶化。在实际拖拉机保养过程中存在着只更换润滑油,不重视零部件的紧固和密封性的检查维护,不按技术条件需定期进行清洗、检查、润滑、调整、坚固,更换部份易损零件,甚至还有一些不进行定期保养的现象,都会影响拖拉机的作业效率和能源消耗。例如空气滤清器横截面堵塞1/3,油耗将提高近2%;如喷油角度较规定提前3&deg;~4&deg;,耗油量增加近2%;气门间隙大或小,都会影响充气量,其中气门间隙过大,油耗会增加近20%[2]。</p>
     </div> 
     <div role="subsection" class="subsection"> 
      <h5><a name="xxxxxx_10">1.4 拖拉机驾驶不规范</a></h5> 
      <p id="11">在实际农业生产使用过程中,拖拉机操作人员大多数没有节能的理念,大脚踩油门、长时间超负荷运行、“大马力拉小车”、档位和速度不匹配、轮胎气压不足等缺乏规范性的操作时有发生,对拖拉机的有效运行造成了较大的影响,增加了不必要的能耗,同时也降低了拖拉机的使用寿命。例如要提高到同样的速度,猛加油门比缓加油门更加费油,更加剧磨损,一次猛加和缓加到同样的速度,油耗相差可达12毫升;低档高速行驶往往使油耗超过正常值的45%[3]。</p>
     </div> 
    </div> 
    <div role="section" class="section"> 
     <h4><a name="xxxxxx_12">2 节能减排措施</a></h4> 
     <div role="subsection" class="subsection"> 
      <h5><a name="xxxxxx_13">2.1 加快推进土地集约化,促进拖拉机市场结构调整</a></h5> 
      <p id="14">大中型拖拉机在实际作业过程中可以大大地提高生产效率以及机械的使用率,对于同一面积的生产用地进行耕地时,应用大中型拖拉机消耗的能源远远少于小型拖拉机,如果生产的面积更大,进行一些深耕工作时,大中型拖拉机还可以表现出更加明显的节能效果。随着我国农村土地流转政策的实施,改变土地经营现状,科学整合土地流转成为了发展现代农业经济的必由之路[4]。同时,加快推进全省农村土地的规模化、集约化经营,有利于大中型拖拉机的普及使用。</p>
     </div> 
     <div role="subsection" class="subsection"> 
      <h5><a name="xxxxxx_15">2.2 加强宣传培训,提升农民节能减排意识和技术水平</a></h5> 
      <p id="16">针对农民群众、农机操作人员、农机维修人员开展节能减排宣传和相关技术培训,不断提高人们的节能减排意识和节能减排技术水平。一是通过积极的宣传与普及环保节能知识,帮助农民认识到拖拉机高能耗所引发的浪费能源等重大问题;二是开展拖拉机操作水平提升培训,使农民规范操作,从使用拖拉机的各个阶段实现节能减排[5];三是在农村设立农业机械专业服务站,通过专业技术人员为农民解决拖拉机的各种问题。</p>
     </div> 
     <div role="subsection" class="subsection"> 
      <h5><a name="xxxxxx_17">2.3 推广应用节能型机型,从源头降低能耗和排放问题</a></h5> 
      <p id="18">解决农业机械高能耗问题的关键是研发与推广节能减排新技术、新机型,从源头降低拖拉机的能耗和污染物排放问题。提供创新合作平台,促进产学研三类机构合作,结合江西省农业产业现状,针对适宜拖拉机机型进行节能减排技术创新研发;通过政策引导,提升农机合作社、种植大户对节能减排机型的购买意愿;针对新型节能减排型拖拉机进行应用推广示范,用实际效果提升此类机型的市场占有率。</p>
     </div> 
    </div> 
    <div role="section" class="section"> 
     <h4><a name="xxxxxx_19">3 总结</a></h4> 
     <p id="20">拖拉机在农业生产中发挥着不可替代的作用,是保障粮食生产的重要农业机械,而随着农业机械化的发展,拖拉机现有市场保有量越来越大。本文通过对江西省拖拉机结构和使用过程中存在的问题进行分析,提出了相应的节能减排措施,对拖拉机的节能减排具有一定的意义,同时也有利于加速拖拉机市场的结构调整和转型升级,促进拖拉机市场从量的增长转向质的提高。</p>
    </div> 
    <div class="bibliography">
     <h4>参考文献:</h4>
     <p>[1]宋万军.探究我国农业机械能耗现状分析及节能减排技术[J].南方农业,2019,13(17):152-153.</p>
     <p>[2]李凯.大型拖拉机的维护保养分析[J].农家科技:中旬刊,2019(4):153.</p>
     <p>[3]陈乔关.浅谈拖拉机驾驶节油措施[J].农家科技旬刊,2015(4):135-136.</p>
     <p>[4]朱立艳.关于农村土地流转对农业经济的影响[J].农家科技(下旬刊),2019(2):223.</p>
     <p>[5]唐军.康平县农业机械能耗现状与节能减排措施[J].农业科技与装备,2012(11):91-92.</p>
    </div>
   </div>
  </div>
 </body>
</html>
更多内容请访问:IT源点

相关文章推荐

全部评论: 0

    我有话说: