zoukankan      html  css  js  c++  java
  • XSL

    Order.xml:
    <?xml version="1.0" encoding="utf-8"?>
    <?xml-stylesheet type="text/xsl" href="Order.xsl"?>
    <Order OrderNo="1234">
     <OrderDate>2001-01-01</OrderDate>
     <Customer>Graeme Malcolm</Customer>
     <Item>
      <Product ProductID="1" UnitPrice="18">Chai</Product>
      <Quantity>2</Quantity>
     </Item>
     <Item>
      <Product ProductID="2" UnitPrice="19">Chang</Product>
      <Quantity>1</Quantity>
     </Item>
    </Order>

    Order.xsl:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
     <xsl:template match="/">
      <html>
       <title>Northwind Web Page</title>
       <body bgcolor="#DDDDDD">
        <table border="1" cellSpacing="0" cellPadding="0" width="500">
         <tr>
          <th>OrderNo</th>
          <th>OrderDate</th>
          <th>Customer</th>
         </tr>
         <tr>
          <td><xsl:value-of select=" Order/@OrderNo"/></td>
          <td><xsl:value-of select="Order/OrderDate"/></td>
          <td><xsl:value-of select="Order/Customer"/></td>
         </tr>
        </table>
        <br/>
        <table border="1" cellSpacing="0" cellPadding="0" width="500">
         <tr>
          <th>ProductID</th>
          <th>ProductName</th>
          <th>UnitPrice</th>
          <th>Quantity</th>
         </tr>
         <xsl:for-each select="Order/Item">
          <tr>
           <td><xsl:value-of select=" Product/@ProductID"></xsl:value-of></td>
           <td>
            <a><xsl:attribute name="HREF">products.aspx?ProductID=<xsl:value-of select="Product/@ProductID"></xsl:value-of></xsl:attribute>
            <xsl:value-of select="Product"></xsl:value-of></a>
           </td>
           <td><xsl:value-of select=" Product/@UnitPrice"></xsl:value-of></td>
           <td><xsl:value-of select="Quantity"></xsl:value-of></td>
          </tr>
         </xsl:for-each>
        </table>
       </body>
      </html>
     </xsl:template>
    </xsl:stylesheet>
  • 相关阅读:
    jmap之使用说明与JVM配置
    Linux之tomcat日志管理
    服务器连接数与资源监控
    Git命令之资源
    状态机
    分布式之消息系统架构
    Memcache之内存分配机制
    LRU算法
    Linux(Ubuntu)之设定开机自启动
    mysql 查询 优化
  • 原文地址:https://www.cnblogs.com/RobotTech/p/552269.html
Copyright © 2011-2022 走看看