transform XHTML to HTML -- namespace problem?

Dear ALL,

I am a newbie..
I got a problem w/ xslt . The problem seems to be the namespace issue of the
source XHTML file. 

Here are my steps:

1) I use tidy to tidy up a html page into xhtml file . 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="ROBOTS" content="NOARCHIVE" />




2) I write a simple stylesheet to extract all td elements.

<html xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xsl:version="1.0">
<head>
<title>aa</title>
</head>

<body>

<xsl:for-each select="//td">
  <p>qq</p>
</xsl:for-each>
</body>
</html>


3) I use Xalan - Java to convert the file. 

However, the transformation gives nothing, and it seems that it never sees
the td nodes.

<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>aa</title>
</head>
<body>
</body>
</html>



4) I removed all the XHTML declaration of the source XHTML file so that it
changed to:

<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="ROBOTS" content="NOARCHIVE" />


And it works now...

I know I did something wrong. Can some experts suggest me?


Many thanks,
KMKU

Received on Thursday, 29 January 2004 04:24:30 UTC