[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl template for simple data-base to transform int

Subject: Re: xsl template for simple data-base to transform into html displayable table
From: "cking" <cking@xxxxxxxxxx>
Date: Thu, 2 Sep 2004 23:50:57 +0200
purchase order template
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 >
 <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
  doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  />

 <xsl:template match="/">
  <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
    <title>Purchase-Orders</title>
   </head>
   <body>
    <xsl:apply-templates/>
   </body>
  </html>
 </xsl:template>

 <xsl:template match="Purchase-Orders">
  <table border="1">
   <tr>
    <th>name</th>
    <th>address</th>
    <th>phone-number</th>
    <th>part-number</th>
    <th>quantity</th>
    <th>price</th>
    <th>total</th>
   </tr>
   <xsl:apply-templates select="Purchase-Order"/>
  </table>
 </xsl:template>

 <xsl:template match="Purchase-Order">
  <tr><xsl:apply-templates/></tr>
 </xsl:template>

 <xsl:template match="Purchase-Order/*">
  <td><xsl:value-of select="."/></td>
 </xsl:template>

</xsl:stylesheet>

This will work if you are certain that the children of <Purchase-Order>
always occur in the same order. If you're not, you can replace the
last two templates with this one:

 <xsl:template match="Purchase-Order">
  <tr>
   <td><xsl:value-of select="name"/></td>
   <td><xsl:value-of select="address"/></td>
   <td><xsl:value-of select="phone-number"/></td>
   <td><xsl:value-of select="part-number"/></td>
   <td><xsl:value-of select="quantity"/></td>
   <td><xsl:value-of select="price"/></td>
   <td><xsl:value-of select="total"/></td>
  </tr>
 </xsl:template>

Cheers,
Anton Triest

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.