Re: [xsl] Transformation with DocType and NameSpace

Subject: Re: [xsl] Transformation with DocType and NameSpace
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 22 Jul 2010 12:30:30 +0200
Ramkumar V wrote:

I am doing HTML to XML Transformation using Saxon/XSLT2.0. Unable to transform when input html contains doc type and Name space as shown below

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<html xml:lang="en-gb" xmlns="http://www.w3.org/1999/xhtml";>


If I remove the doc type and name space, it is working fine. I need to keep this in input file and do the transformation, please provide me the solution for this.

What exactly happens, do you get any error messages? As for taking the namespace into account, that is easy in XSLT 2.0 with <xsl:stylesheet xpath-default-namespace="http://www.w3.org/1999/xhtml"; then you can match on XHTML elements simply with e.g. <xsl:template match="html"> and you can use unqualified names in XPath expressions e.g. <xsl:apply-templates select="body//p"/>

The document type could be a problem that requires using a catalog, see http://sourceforge.net/apps/mediawiki/saxon/index.php?title=XML_Catalogs

--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread