Re: XPath difference between <xsl:output method="html"> and "xml"

"C.W.Holeman II" <[email protected]> Thu, 12 Apr 2007 06:34:52 -0800
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Message-ID <[email protected]>
"C.W.Holeman II" <[email protected]> wrote in message 
news:[email protected]...
>
> "Martin Honnen" <[email protected]> wrote in message 
> news:[email protected]...
>> C.W.Holeman II wrote:
>>
>>> How do I locate the body element with XPath?
>>
>> With XPath 1.0 if you have a path
>>   element-name
>> (or e.g. body) then the XPath expression selects elements of that name 
>> (e.g element-name or body) in _no_ namespace while XHTML elements are in 
>> the namespace http://www.w3.org/1999/xhtml. To select elements in a 
>> namespace you need to bind a prefix (e.g. 'xhtml) to the namespace URI 
>> and use that prefix in your expression (e.g. xhtml:body). So with the W3C 
>> DOM Level 3 XPath API you use a namespace resolver as follows
>>
>> var body = document.evaluate(
>>   "//xhtml:body",
>>   document,
>>   function lookupNamespaceURI (prefix) {
>>     switch (prefix) {
>>       case 'xhtml':
>>         return 'http://www.w3.org/1999/xhtml';
>>     }
>>   }, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
>
> I attempted to put that directly in and got the same results of "null"
> for body. I do not see any prefix of "xhtml" in the code so I thought
> the value of prefix in the case statement may not be correct.

Then I found that in my editting that I missed the change in the XPath 
expression
to include "xhtml:". That works, thank you.

Third, working version:

http://emle.sourceforge.net/emle020000/zx3.xml
http://emle.sourceforge.net/emle020000/zx3.xsl

-- 
C.W.Holeman II | [email protected] -5 | http://JulianLocals.com/cwhii
 To only a fraction of the  human  race does God  give the  privilege of
 earning one's bread doing what one would have  gladly pursued free, for
 passion. I am very thankful. The Mythical Man-Month Epilogue/F.P.Brooks