Re: [xsl] doctype is confusing me...

Subject: Re: [xsl] doctype is confusing me...
From: Mike Brown <mike@xxxxxxxx>
Date: Mon, 17 Feb 2003 15:50:10 -0700 (MST)
Ted Stresen-Reuter wrote:
> Hi,
> 
> I'm trying to transform XHTML files (extracting the form element). I'm  
> finding that with the xalan processor if I include the doctype  
> declaration at the top of the document (with or without the xml  
> processing instruction: <?xml version="1.0"?>)

There's no such thing as an XML processing instruction. That's an XML
declaration or text declaration, *not* a processing instruction. It just
happens to have a similar syntax.

>, that the following  
> style sheet fails to see elements below the root of the document.  
> However, if I move the doctype declaration, it works as expected. What  
> am I missing here?
> 
> Thanks in advance!
> 
> Ted Stresen-Reuter
> 
> Here's the doctype declaration I'm using: <!DOCTYPE html PUBLIC  
> "-//W3C//DTD XHTML 1.0 Transitional//EN"  
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

1. If you haven't got a proxy or a catalog set up to retrieve the DTD locally,
you're going out over the net to w3.org every time you parse that XML. Is that
kind of overhead really what you want?

2. The DTD in question sets a default xmlns attribute on the "html" element.
Once that happens, none of the elements are in the empty namespace. Bind the
XHTML namespace to a prefix like "xhtml" in your stylesheet, and then you can
do things like <xsl:template match="html|xhtml:html"> to make the template
match an 'html' element in both the empty and XHTML namespaces.

Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread