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

Should be simple -- XSLT on XHTML document

Subject: Should be simple -- XSLT on XHTML document
From: Kynn Bartlett <kynn@xxxxxxxxxxxx>
Date: Sun, 13 Aug 2000 16:02:20 -0700
apply xslt to xhtml
I'm trying to apply an XSLT stylesheet to an XHTML document to produce
a new XHTML document with style="..." tags added.  For some reason it's
not working.

Here's what I start with:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>A Simple Data Table</title>
</head>
<body>
<table>
  <tr>
    <th>Dog Name</th>
    <th>Sex</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>Angie</td>
    <td>female</td>
    <td>10</td>
  </tr>
  <tr>
    <td>Xena</td>
    <td>female</td>
    <td>2</td>
  </tr>
  <tr>
    <td>Kim</td>
    <td>male</td>
    <td>10</td>
  </tr>
</table>
</body>
</html>


Here's my XSLT:


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

  <xsl:strip-space elements="*"/>
  <xsl:output indent="yes"/>

  <xsl:template match="/">
    <html>
      <head>
        <title>Bartlett Dogs</title>
      </head>
      <body>
        <h1 style="font-family: Arial, Geneva, Helvetica, sans-serif">Bartlet
t Dogs</h1>
        <xsl:apply-templates select="html/body/*" />
      </body>
    </html>
  </xsl:template>

  <xsl:template match="table">
    <table border="0" width="585" style="background-color: green;" cellspacin
g="4">
      <xsl:apply-templates />
    </table>
  </xsl:template>

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

  <xsl:template match="th">
    <th align="left" style="background-color: white; font-weight: bold; font-
family: Arial, Geneva, Helvetica, sans-serif">
      <xsl:apply-templates />
    </th>
  </xsl:template>

  <xsl:template match="td">
    <td align="left" style="background-color: yellow; font-weight: bold; font
-family: Arial, Geneva, Helvetica, sans-serif">
      <xsl:apply-templates />
    </td>
  </xsl:template>

</xsl:stylesheet>

The output (on both MS's parser and Saxon) is the following:

<?xml version="1.0" encoding="utf-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title>Bartlett Dogs</title>
   </head>
   <body>
      <h1 style="font-family: Arial, Geneva, Helvetica, sans-serif">Bartlett
Dogs</h1>
   </body>
</html>


I'm sure it must be something painfully obvious, but I can't see it, and neither can one of my friends. What glaringly obvious thing have I overlooked here?

--
--
Kynn Bartlett <kynn@xxxxxxxxxxxx>
http://www.kynn.com/


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.