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]

Re: xPath and default namespaces.



> I'm having some problems with resolving an xPath expression on some XML that
> sets a default namespace like this XHTML code.

this is a FAQ, but basically 

<html xmlns="http://www.w3.org/1999/xhtml";

is an element with local name html in the XHTML  namespace 

and

 "//body"
is a (very inefficient) XPath looking for all instances of an element
with local name body in no namespace. In particular this does not match
any element in the XHTML namespace.

You want to add
xmlns:h="http://www.w3.org/1999/xhtml"; 

to your xsl:stylesheet then match on

h:body rather than body.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

 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]