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

RE: Reprocessing XHTML with XSLT

Subject: RE: Reprocessing XHTML with XSLT
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 31 Oct 2002 23:43:38 -0000
h2 xhtml
You'll probably find that harmless-looking XHTML DTD is declaring a
default namespace for you - a practice which should be punishable by
flogging.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Peter Flynn
> Sent: 31 October 2002 22:34
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Reprocessing XHTML with XSLT
> 
> 
> I've either lost those last few remaining neurons, or I've 
> missed something rather important in the documentation (it's 
> the first time I've needed to do an XML-to-XML transformation 
> in anger, too :-)
> 
> I had a moderately well-formed HTML file from a user which I 
> ran through Tidy -asxml to turn it into WF XHTML. I mended 
> some errors* and it's now valid. I then started writing some 
> XSLT (below) to turn it into the required XML markup.
> 
> But running it through xt or Cocoon only fires the document 
> root template and nothing else, so I get output with the data 
> content enclosed in the specified root element tags 
> (<modules>...</modules>) and the rest is dogfood -- as if I 
> had not specified any other templates. I've tried with both 
> the literal result elements and with <xsl:element> but the 
> same occurs.
> 
> Why is it failing to match the remaining templates? There 
> doesn't seem to be anything in Dave's FAQ or any of the books 
> I've got, which only cover XHTML *output*, so I'm making the 
> conclusion that I've missed something significant in the spec.
> 
> ///Peter
> -- 
> Minimal example:
> 
> ---------- test.xhtml
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>      "/dtds/xhtml1-transitional.dtd">
> <html>
>    <head>
>      <title>some title</title>
>    </head>
>    <body>
>      <table>
>        <tr>
> 	<td>stuff to ignore</td>
> 	<td>more stuff</td>
>        </tr>
>      </table>
>      <h2>a heading</h2>
>      <p>just text</p>
>    </body>
> </html>
> 
> ---------- extract.xsl
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                  version="1.0">
> 
>    <xsl:output method="xml"/>
> 
>    <xsl:strip-space elements="*"/>
> 
>    <xsl:template match="/">
>      <modules>
>        <xsl:apply-templates/>
>      </modules>
>    </xsl:template>
> 
>    <xsl:template match="html">
>      <xsl:apply-templates/>
>    </xsl:template>
> 
>    <xsl:template match="head | table | p"/>
> 
>    <xsl:template match="body">
>      <xsl:apply-templates/>
>    </xsl:template>
> 
>    <xsl:template match="h2">
>      <module>
>        <xsl:apply-templates/>
>      </module>
>    </xsl:template>
> 
> </xsl:stylesheet>
> 
> ---------- output
> 
> <?xml version="1.0" encoding="utf-8"?>
> <modules>some titlestuff to ignoremore stuffa headingjust 
> text</modules>
> 
> ----------
> * It appears that Tidy fails to convert NAME attributes which 
> are comprised of digits only to a suitable form beginning 
> with a letter when it outputs them as ID values, in order to 
> conform with being XML Names.
> 
> 
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 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.