[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] xsl template for simple data-base to transform into htm l displayable table


Subject: RE: [xsl] xsl template for simple data-base to transform into htm l displayable table
From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx>
Date: Thu, 2 Sep 2004 16:49:36 -0500

Hi Stephen,

First of all, your XML was not well-formed, it missed one '>' in the
document node. Guess it must have been a typo.

Then, you must mean a xsl stylesheet as a template I suppose? Then this
might help you:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output indent="yes"/>

<xsl:template match="/Purchase-Orders">
  <table border="1">
    <xsl:apply-templates select="Purchase-Order"/>
  </table>
</xsl:template>

<xsl:template match="Purchase-Order">
  <th>
    <xsl:value-of select="name" />
  </th>
  <tr>
     <xsl:apply-templates select="@*|node()"/>
  </tr>
</xsl:template>

<xsl:template match="@*|node()">
  <td>
    <xsl:value-of select="." />
  </td>
</xsl:template>

<xsl:template match="name"/>

</xsl:stylesheet> 

Cheers,
</prs>

-----Original Message-----
From: Bovy, Stephen J [mailto:STEPHEN.Bovy@xxxxxx] 
Sent: Thursday, September 02, 2004 4:19 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] xsl template for simple data-base to transform into html
displayable table 

I would like to find a simple xml template to convert something like this:

<Purchase-Orders 

<Purchase-Order>                             
  <name>Steve Bovy</name>                    
  <address>9301 Pali Ave</address>           
  <phone-number>818-352-9917</phone-number>  
  <part-number> 1234</part-number>           
  <quantity>-1</quantity>                    
  <price>-15.41</price>                      
  <total>-45.32</total>                      
</Purchase-Order>                            

<Purchase-Order>                             
  <name>John Doe</name>                      
  <address>Never Land</address>              
  <phone-number>818-999-9999</phone-number>  
  <part-number> 3241</part-number>           
  <quantity> 20</quantity>                   
  <price> 15.41</price>                      
  <total> 45.32</total>                      
</Purchase-Order>                            
                                             
</Purchase-Orders>                           


Into a Displayable HTML "table" 

Has anyone written somehting like this, or can point me to such a template
????


Current Thread
Keywords