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

📄 productdetails.xsl

📁 全面应用Java网络Web
💻 XSL
字号:
<?xml version = "1.0"?>

<!-- ProductDetails.xsl                                    -->
<!-- XSLT stylesheet for transforming content generated by -->
<!-- GetProductServlet into XHTML.                         -->

<xsl:stylesheet version = "1.0"
   xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">

   <xsl:output method = "xml" omit-xml-declaration = "no" 
      indent = "yes" doctype-system = "DTD/xhtml1-strict.dtd"
      doctype-public = "-//W3C//DTD XHTML 1.0 Strict//EN"/>

   <!-- include template for processing error elements -->
   <xsl:include href = "/XSLT/XHTML/error.xsl"/>
   
   <!-- template for product element -->
   <xsl:template match = "product">
      <html xmlns = "http://www.w3.org/1999/xhtml" 
            xml:lang = "en" lang = "en">

      <head>
         <title>
            <xsl:value-of select = "title"/> -- Description
         </title>

         <link rel = "StyleSheet" href = "styles/default.css"/>
      </head>

      <body>

         <!-- copy navigation header into XHTML document -->
         <xsl:for-each select = 
            "document( '/XSLT/XHTML/navigation.xml' )">
            <xsl:copy-of select = "."/>
         </xsl:for-each>

         <div class = "header">
            <xsl:value-of select = "title"/>
         </div>
         
         <div class = "author">
            by <xsl:value-of select = "author"/>
         </div>

         <!-- create div element with details of Product -->
         <div class = "productDetails">
            <table style = "width: 100%;">
               <tr>
                  <td style = "text-align: center;">
                     <img class = "bookCover" 
                        src = "images/{image}"
                        alt = "{title} cover image."/> 
                  </td>

                  <td>
                     <p style = "text-align: right;">
                        Price: <xsl:value-of select = "price"/>
                     </p>

                     <p style = "text-align: right;">
                        ISBN: <xsl:value-of select = "ISBN"/>
                     </p>

                     <p style = "text-align: right;">
                        Pages: <xsl:value-of select = "pages"/>
                     </p> 

                     <p style = "text-align: right;">
                        Publisher: 
                        <xsl:value-of select = "publisher"/>
                     </p>

                     <!-- AddToCart button -->
                     <form method = "post" action = "AddToCart">
                        <p style = "text-align: center;">
                           <input type = "submit" 
                              value = "Add to cart"/>

                           <input type = "hidden" name = "ISBN" 
                              value = "{ISBN}"/>
                        </p>
                     </form>
                  </td>
               </tr>
            </table>
         </div>

      </body>
      </html>
   </xsl:template>

<!-- 
  (C) Copyright 2001 by Deitel & Associates, Inc. and         
  Prentice Hall. All Rights Reserved.                         
                                                              
  DISCLAIMER: The authors and publisher of this book have     
  used their best efforts in preparing the book. These        
  efforts include the development, research, and testing of   
  the theories and programs to determine their effectiveness. 
  The authors and publisher make no warranty of any kind,     
  expressed or implied, with regard to these programs or to   
  the documentation contained in these books. The authors     
  and publisher shall not be liable in any event for          
  incidental or consequential damages in connection with, or  
  arising out of, the furnishing, performance, or use of      
  these programs.                                             
 -->

</xsl:stylesheet>

⌨️ 快捷键说明

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