This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xhtml DOCTYPE problem
- From: Steven Noels <stevenn at outerthought dot org>
- To: "'XSL-List at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 17 Jan 2002 04:51:13 -0600 (CST)
- Subject: Re: [xsl] xhtml DOCTYPE problem
- Reply-to: xsl-list at lists dot mulberrytech dot com
On Thu, 17 Jan 2002, Houbrechts Ivo wrote:
> I have a simple xhtml document:
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE html SYSTEM "xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <title>my title</title>
> </head>
> <body>
> <p>para</p>
> </body>
> </html>
>
> Following template only outputs an emptye <test/>:
>
> <xsl:template match="/">
> <test>
> <xsl:value-of select="html/head/title"/>
> </test>
> </xsl:template>
you are trying to match elements which reside in the (default) xhtml
namespace
add a namespace declaration to your stylesheet element and you should be
fine:
<xsl:stylesheet xmlns:xsl="..." xmlns:xhtml="http://www.w3.org/1999/xhtml"
...
and then change your pattern to:
<xsl:value-of select="xhtml:html/xhtml:head/xhtml:title"/>
> Notes:
> -I tried this with both xalan and saxon
> -I had to change the DOCTYPE to SYSTEM and store the dtd locally, otherwise
> the xslt-processor cannot find it.
There's a number of work-arounds for that, but largely depending on your
setup.
Steven Noels
http://outerthought.org/
+32/478/292900
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list