⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menu.xsl

📁 Windows Web脚本开发指南/(美) Dan Heflin, Todd Ney著 的源码
💻 XSL
字号:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="categories">
  <table BGCOLOR='#00FFFF'>
  <thread><th colspan="2">Shoping Areas</th></thread>
  <xsl:for-each select="category">
     <tr>
       <td width="15px"><img src="image/arrow.gif" /></td> 
       <td class="nav">
         <xsl:attribute name="onClick">buildNextPage('<xsl:value-of select="@catID" />')</xsl:attribute>
         <xsl:value-of select="@products" />
       </td>
     </tr>
  </xsl:for-each>
  </table>
</xsl:template>
<xsl:template match="featureItems">
  <table>
  <thread><th colspan="2">Featured Items</th></thread>
  <xsl:for-each select="referTo:item">
     <tr>
       <td rowspan="2"><img>
         <xsl:attribute name="src"><xsl:value-of select="id(@referToItem)/imagePath"/></xsl:attribute>
        </img></td>
       <td class="nav">
         <xsl:attribute name="onClick">buildSingle('<xsl:value-of select="@referToItem" />', '<xsl:value-of select="ancestor(category)/@catID" />' )</xsl:attribute>
         <u><xsl:value-of select="id(@referToItem)/shortDesc" /></u>
       </td>
    </tr> 
    <tr> 
       <td>Price: 
         $<xsl:value-of select="id(@referToItem)/price" />
       </td>
     </tr>
  </xsl:for-each>
  </table>
</xsl:template>
<xsl:template match="itemList">
  <table>
  <thread><th colspan="2">Product List</th></thread>
  <xsl:for-each select="item">
     <tr>
       <td><img>
         <xsl:attribute name="src"><xsl:value-of select="imagePath"/></xsl:attribute>
        </img></td>
       <td>
         <xsl:value-of select="longDesc" />
       </td>
    </tr> 
    <tr> 
       <td colspan="2">
         <table width="100%"><thread><th align="Left">Item #</th><th align="Left">Description</th><th align="Right">Price</th><th>Quantity</th></thread>
           <tr>
             <td>         
               <xsl:value-of select="@id" />
             </td>
             <td>         
               <xsl:value-of select="shortDesc" />
             </td>
             <td align="Right">         
               $<xsl:value-of select="price" />
             </td>
             <td align="Center">         
               <input type="text" maxlength="5" size="5">
                 <xsl:attribute name="itemID"><xsl:value-of select="@id"/></xsl:attribute>
               </input> 
             </td>
           </tr>
         </table>
       </td>
       <tr><td colspan="2"><hr/></td></tr>
     </tr>
  </xsl:for-each>
  </table>
</xsl:template>
<xsl:template match="target:item">
  <table>
  <thread><th colspan="2">Featured Item</th></thread>
  <tr>
    <td><img>
      <xsl:attribute name="src"><xsl:value-of select="imagePath"/></xsl:attribute>
    </img></td>
    <td>
      <xsl:value-of select="longDesc" />
    </td>
  </tr> 
  <tr> 
    <td colspan="2">
      <table width="100%"><thread><th align="Left">Item #</th><th align="Left">Description</th><th align="Right">Price</th><th align="Center">Quantity</th></thread>
        <tr>
          <td>         
            <xsl:value-of select="@id" />
          </td>
          <td>         
            <xsl:value-of select="shortDesc" />
          </td>
          <td align="Right">         
            $<xsl:value-of select="price" />
          </td>
          <td align="Center">         
            <input type="text" maxlength="5" size="5">
              <xsl:attribute name="itemID"><xsl:value-of select="@id"/></xsl:attribute>
            </input> 
          </td>
        </tr>
      </table>
    </td>
    <tr><td colspan="2"><hr/></td></tr>
  </tr>
  </table>
</xsl:template>
<xsl:template match="cart">
  <xsl:script>
    var cartTotal = 0;
    function calculateTotal(){
      var qty = this.selectSingleNode("quantity").text;
      var price = this.selectSingleNode("price").text;
      var total = qty * price; 
      cartTotal += total;
      return total;
    }
  </xsl:script>
  <table width="100%">
  <thread><th align="Left">Item #</th><th align="Left">Description</th><th align="Right">Price</th><th>Quantity</th><th align="Right">Total</th></thread>
  <xsl:for-each select="item">
     <tr>
       <td>         
         <xsl:value-of select="@id" />
       </td>
       <td>         
         <xsl:value-of select="shortDesc" />
       </td>
       <td align="Right">         
         $<xsl:value-of select="price" />
       </td>
       <td align="Center">         
         <input type="text" maxlength="5" size="5">
           <xsl:attribute name="itemID"><xsl:value-of select="@id"/></xsl:attribute>
           <xsl:attribute name="value"><xsl:value-of select="quantity"/></xsl:attribute>
         </input> 
       </td>
       <td align="Right">         
         $<xsl:eval>calculateTotal()</xsl:eval>
       </td>
     </tr>
  </xsl:for-each>
  <tr><td colspan="5"><hr/></td></tr>
  <tr><td colspan="4" align="right">Total:</td><td align="Right">$<xsl:eval>cartTotal</xsl:eval></td></tr> 
  </table>
</xsl:template>
</xsl:stylesheet>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -