This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Should be simple -- XSLT on XHTML document
- To: xsl-list at mulberrytech dot com
- Subject: Should be simple -- XSLT on XHTML document
- From: Kynn Bartlett <kynn at idyllmtn dot com>
- Date: Sun, 13 Aug 2000 16:02:20 -0700
- Cc: satan at surly dot org
- Reply-To: xsl-list at mulberrytech dot com
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@idyllmtn.com>
http://www.kynn.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list