|
Subject: [xsl] xslt & doctype problem From: Glyph <glyph@xxxxxxxxxxx> Date: Mon, 17 Oct 2005 11:16:36 +1000 |
Hoping its something stupid (and thus easy to fix) -G.
----- clean.xslt --------------------------------- <?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes" omit-xml-declaration="yes"/>
<!-- start at root of document -->
<xsl:template match="/">
<xsl:message terminate="no">
Trace: root -<xsl:value-of select="name()" />-
</xsl:message>
<html>
<xsl:apply-templates select="*" />
</html>
</xsl:template><xsl:template match="html">
<xsl:message terminate="no">
Trace: html
</xsl:message>
<xsl:copy>
<xsl:apply-templates select="*" />
</xsl:copy>
</xsl:template><xsl:template match="head">
<xsl:message terminate="no">
Trace: head
</xsl:message>
<xsl:copy>
<xsl:if test="not(title)">
<title> No Title Given </title>
</xsl:if>
<xsl:apply-templates />
</xsl:copy>
</xsl:template><xsl:template match="body">
<xsl:message terminate="no">
Trace: body
</xsl:message>
<xsl:copy>
<h1>
<!-- potentially empty header -->
<xsl:copy-of select="../head/title" />
</h1>
<xsl:apply-templates mode="inner" />
</xsl:copy>
</xsl:template><!-- copy generic nodes -->
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:message terminate="no">
Trace: generic -<xsl:value-of select="name()" />-
</xsl:message>
<xsl:apply-templates />
</xsl:copy>
</xsl:template><!-- copy generic nodes without trace --> <xsl:template mode="inner" match="*"> <xsl:copy> <xsl:copy-of select="@*" /> <xsl:apply-templates mode="inner" /> </xsl:copy> </xsl:template>
</xsl:transform> ------------------------------------------
----dummy.html-------------------------- <html> <head> <meta name="fish" value="Carp" /> </head> <body> <h1>carp</h1> <p>Im not going to harp on about carp</p> <p>Just going to include a simple  </p> </body> </html> ------------------------------------------
<html> <head> <meta name="fish" value="Carp" /> </head> <body> <h1>carp</h1> <p>Im not going to harp on about carp</p> <p>Just going to include a simple </p> </body> </html> ------------------------------------------
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] JAXP - Ignoring whitespac, Michael Kay | Thread | Re: [xsl] xslt & doctype problem, Geert Josten |
| Re: [xsl] Which patterns will selec, Dimitre Novatchev | Date | [xsl] Help getting started with XSL, Karl Stubsjoen |
| Month |