码迷,mamicode.com
首页 > 其他好文 > 详细

XSL相关

时间:2016-07-08 18:05:16      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="C:\Users\Administrator\Desktop\emp1.xsl" ?>
<employees>
  <employee on="01">
    <name>Tom</name>
    <sex>男</sex>
    <birth>
      <year>1982</year>
      <month>5</month>
      <day>22</day>
    </birth>
    <sales>
      <year>2010</year>
      <month>1</month>
      <sale>320000</sale>
    </sales>
    <salary>8600</salary>
  </employee>
  
  <employee on="02">
    <name>Jack</name>
    <sex>男</sex>
    <birth>
      <year>1981</year>
      <month>7</month>
      <day>10</day>
    </birth>
    <sales>
      <year>2010</year>
      <month>1</month>
      <sale>300000</sale>
    </sales>
    <salary>6000</salary>
  </employee>
  <employee on="03">
    <name>Jennifer</name>
    <sex>女</sex>
    <birth>
      <year>1982</year>
      <month>6</month>
      <day>22</day>
    </birth>
    <sales>
      <year>2010</year>
      <month>1</month>
      <sale>500000</sale>
    </sales>
    <salary>7000</salary>
  </employee>
  
</employees>
=========================================================
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:fo="http://www.w3.org/1999/XSL/Format" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:fn="http://www.w3.org/2005/xpath-functions" 
xmlns:xdt="http://www.w3.org/2005/xpath-datatypes">
<!-- 模板 -->
  <xsl:template match="/employees/employee">
     <html>
<head><title></title></head>
<body>
   <div>
                    <u>
       <h2>编号:<xsl:value-of select="@no"/>  </h2>
           </u>    
   </div>
   <div>
       姓名:<xsl:value-of select="name"/>
   </div>
   <div>
        <i> 
          生日:
          <xsl:value-of select="birth/year"/>年
          <xsl:value-of select="birth/month"/>月
          <xsl:value-of select="birth/day"/>日
        </i>
   </div>
</body>
     </html>
  </xsl:template>
</xsl:stylesheet>

XSL相关

标签:

原文地址:http://www.cnblogs.com/blogLYF/p/5653958.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!