Re: [xslt] Re: simpler testcase



On Fri, Mar 28, 2003 at 09:46:05AM -0500, Tod Harter wrote:
> Part of the problem here is that the SPEC is 'broken'. How do you select with 
> XPath an element that is in a default namespace? There is no prefix you can 
> place in the XPath statement!!! Your stuck!

 Perfectly wrong !
 Either:
  1/ you map the default namespace name of your target nodes to
     a namespace with a prefix in the context of the XPath expression
     i.e. map foo to the default namespace name and use
        /foo:name
     this is the prefered solution and every correct use of XPath should
     allow you to do such a namespace mapping
  2/ or if you can't define such a namespace mapping you build your 
     XPath expression with the local-name() and namespace-uri() defined
     in the XPath spec:
       http://www.w3.org/TR/xpath#function-local-name
        /*[local-name() = 'name' and namespace-uri() = 'default namespace name']
       
 Again before asserting that a spec or code associated to it is broken,
it's better to read the associated spec and make sure your understand it !

> I had this problem with parsing 
> some XHTML the other day where everything was in the default namespace. In 
> XSLT you're template can specifiy the same namespace as the default and then 
> IIRC you get a match, but what if you had to deal with multiple namespaces? 
> The entire concept of default namespaces makes me grind my teeth. Its like 
> autovivification of variables and hash keys in perl. Anyone designing XML 
> processing systems DO NOT USE DEFAULT NAMESPACES, ever ever ever!

  Sorry, this is crap. Simply define the xmlns:xhtml="XHTML namespace"
at the top of your XSLT stylesheet and use xhtml:html etc. in your
template match and embedded XPath expressions. People have done that
for years without trouble, you're just showing ignorance here. Sorry
that doesn't give you the right to shout on the topic ...

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]