This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Processing HTML document.


Antonio Fiol wrote:
> Oleg Tkachenko wrote:
> 
> > Declare xhtml namespace in the stylesheet and use something like 
> > "x:html/x:body/x:table...", where x is a defined by you xhtml 
> > namespace prefix. 
> 
> 
> I tried that just _before_ reading your e-mail. It worked.
> 
> However, it should be possible to use the raw "html/body/table...", 
> shouldn't it?
> 
> When I have an XML input (home made XML, using default namespace, just 
> like the HTML file I'm inputting), I simply name the tags I want, and it 
> works just fine (!)

Yes, it does, but only because XPath expressions are designed to be so 
convenient for working with elements that are in no namespace. Once you 
introduce namespaces, they become more complex (yet in a way, they're still 
very simple...)

The XPath expression

  foo/bar/baz

means

  child::foo/child::bar/child::baz.

In practice, child::foo is essentially equivalent to:

  child::*[namespace-uri()='' and local-name()='foo']

It is not, as you might hope, equivalent to child::*[name()='foo'].

If you have x:foo instead of foo, by definition it means 'element "foo" in the 
namespace URI that is bound to the "x" prefix'. If that URI is 
"http://some/unique/URI";, then child::x:foo essentially means:

  child::*[namespace-uri()='http://some/unique/URI' and local-name()='foo']

I hope this helps.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]