Re: [xslt] Namespace problem



On Mon, Apr 30, 2001 at 05:20:54PM +0000, Bjorn Reese wrote:
> Thomas Broyer wrote:
> 
> > That's the expected behaviour.
> > 
> > Matching is done against the namespace URI, not the prefix.
> 
> > This stylesheet is invalid since the ns namespace prefix isn't declared.
> 
> Thanks for the reply.
> 
> Now, this is were my ignorance sets in. Does all namespaces in the xml
> file have to be defined in the stylesheet?
> 
> If so, is it possible to have a template that matches only the tag name?
> (e.g. 'root' in 'ns:root')

 
  Hum, I'm afraid it would be wrong. XSLT allows name test as from the
XPath production:

http://www.w3.org/TR/xpath#NT-NameTest
[37]   NameTest ::=   '*'
		  |   NCName ':' '*'
		  |   QName

QName is actually inherited from the namespace in XML REC

[6] QName ::= (Prefix ':')? LocalPart
[7] Prefix ::= NCName

  which means that:
    ns:*
  is allowed but
    *:root
  is not allowed

  and I'm afraid that just 'root' does only match root elements without
a namespace...

Daniel


-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
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]