This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
XML source with DOCTYPE declaration
- To: XSL-List at lists dot mulberrytech dot com
- Subject: [xsl] XML source with DOCTYPE declaration
- From: Zeljko Rajic <zeljko dot rajic at brokat dot com>
- Date: Wed, 18 Apr 2001 14:02:04 +0200
- Organization: Brokat AG
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi there,
I am new to XSLT an hope somebody out there can help me with my problem:
I got some XML files I have to transform using XSLT. These XML files did
not contain a DOCTYPE declaration. I made the XSLT stylesheet as it was
requested and everything worked fine.
Then I added a DOCTYPE declaration to the XML file. As it is an XHTML
Basic document, I added:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
After inserting the DOCTYPE declaration, the XSLT transformation did not
work anymore: as result I receive an 'empty page'! :( After some
testing it seems my template for the first element (<html>) isn't being
called anymore !! :(
My stylesheet basically looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/XML/XLink/0.9">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="/html/body"/>
</xsl:template>
<xsl:template match="node()[@title='article']">
<xsl:text>Article Found !!!</xsl:text>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
The XML file that should be transformed basically looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html>
<head>
<title/>
</head>
<body title="article">
Some article text !!
</body>
</html>
Before I forget: I am using Xalan J 2.0.0 on Windows 2000.
Does anybody can tell me why the transformation works well without a
DOCTYPE in the source XML file, and why the transformation fails when
the XML source file contains a DOCTYPE??
Are there any points I have to attention to when using DOCTYPE or
restrictions I am not aware of??
Any suggestions and tips are highly appreciated !!
Regards,
Zeljko
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list