[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Should be simple -- XSLT on XHTML document
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>
-- -- Kynn Bartlett <kynn@xxxxxxxxxxxx> http://www.kynn.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|