Page 179 - E-Bussiness and E-Commerce Management Strategy, Implementation, and Practice
P. 179

M03_CHAF9601_04_SE_C03.QXD:D01_CHAF7409_04_SE_C01.QXD  16/4/09  11:09  Page 146





                146  Part 1 Introduction


                                 The XSL document uses HTML tags to instruct the browser how the data within the XML
                                 file should be displayed. Separation of data from their presentation method makes this a
                                 more powerful approach than combining the two since different presentation schemes such
                                 as with and without graphics can readily be switched between according to user preference.



                                   Presentation: Document Style Sheet File <books.xsl>
                                   <?xml version="1.0"?>
                                   <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
                                   <xsl:template match="/">
                                         <html> <body>
                                             <table cellpadding="2" cellspacing="0" border="1"
                                             bgcolor="#FFFFD5"> <tr>
                                             <th>Title</th>
                                                  <th>Author</th>
                                                  <th>Publisher</th>
                                                  <th>Date</th>
                                                  <th>ISBN</th>
                                             </tr> <xsl:for-each select="Bookstore/Book">
                                             <tr><td><xsl:value-of select="Title"/></td>
                                                  <td><xsl:value-of select="Author"/></td>
                                                  <td><xsl:value-of select="Publisher"/></td>
                                                  <td><xsl:value-of select="Date"/></td>
                                                  <td><xsl:value-of select="ISBN"/></td>
                                                  </tr> </xsl:for-each>
                                             </table>
                                         </body> </html>
                                   </xsl:template>
                                   </xsl:stylesheet>

                                   Note: The style sheet uses standard HTML tags to display the data


                                 This stylesheet would display the data as follows:




                    Display of data through browser

                    Title           Author           Publisher       Date             ISBN
                    E-business and  Dave Chaffey     Pearson Education  30 November 2003  0273683780
                    E-commerce
                    Management
                    Total E-mail    Dave Chaffey     Butterworth     20 February 2003  0750657545
                    Marketing                        Heinemann
   174   175   176   177   178   179   180   181   182   183   184