xsl-list
[Top] [All Lists]

Re: deep "copy-of" a source fragment

2002-09-05 02:35:14

he HTML Tidy program outputs an [unqualified?] xmlns attribute 
(declaration) in the <html> root element so the namespace is "html". 

No that means the namespace for unprefixed elements is
http://www.w3.org/1999/xhtml

what is the deal with "where" you declare the namespace? Does it matter?
when you use x:html in any Xpath the x: refers to the namespace binding
in scope at that point. You can put xmlns:x="..." on _any_ ancestor
element of that point of teh stylesheet, but it has to be somewhere
otherwise x: will not be declared.

Must I do all my declarations in the root element?

usually prefixes are constant over the whole stylesheet so if you put
them all at the top you only need to do it once.

** My only concern is that if for whatever reason the namespace 
declaration changes, it will [silently] "break" my XSL templates. 

A namespace is part of the name. the above is tru but it is _exactly_
the same as saying that a template match="html" will break if you change
the name of the element in the source to <html2>.

 So 
maybe I will take the easy way out and suppress namespace declarations 
in my xhtml source reducing it to an anonymous well-formed document 
which is xhtml by convention (rather than validity).


but it won't be xhtml (by convention or otherwise). The whole point of
namespaces is that systems know what kind of element they have. if you
make the elements anonymous then they are well, anonymous.

If you sent elements in teh xhtml namespace tp mozilla or netscape 6/7
then they will render using html semantics. if you send (as text/xml)
a document in no namespace which just happens to have elements called
<html <head etc, then it will be treeted as unstyled, unkown, xml and
not rendered at all.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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