This problem is a really common gotcha for people learning XPath, and I ran into it too. The problem is that since XPath expressions take advantage of namespace mappings in effect where the XPath is found, it's natural to assume the default mapping also is taken into consideration. However XPath says that any unprefixed component (axis) of the expression always maps to *no namespace* rather than the intuitive default mapping. The expression '/html' would NOT test for {http://www.w3.org/1999/xhtml}:html elements, but for an html element with no namespace. To fix your problems, all your xpath axes must include a prefix that is mapped to the XHTML namespace: /xhtml:html/xhtml:head/xhtml:meta .

best,
christian.

On Saturday, July 19, 2003, at 12:04 PM, [EMAIL PROTECTED] wrote:

The issue below i would guess is something to do with namespaces. Can some kind soul tell me the correct notation for the XPath expression?

From: [EMAIL PROTECTED]
Date: Wed Jul 16, 2003  3:30:38  PM America/New_York
To: [EMAIL PROTECTED]
Subject: xhtml - no output!


Querying the nodes in the following doesn't return anything. I must be making some obvious noobie mistake. Can someone enlighten me please?

G00se

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
  <!-- #BeginTemplate "/Templates/genericX.dwt" -->

  <head>
    <!-- #BeginEditable "Head-tags" -->
    <!-- TITLE AND META TAGS GO IN HERE -->

<title>Mantex homepage</title>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
<meta name="description"
content="mantex - educational software and books. free resources for
teaching and learning. services in writing, editing, business communication.
electronic publishing and book reviews." />
<meta name="keywords"
content="writing skills,style guides,essays,term papers,reports,study
skills,revision,exams,essay-marking, guidance notes,tip sheets,english
language,diagnostic tests,helpdisk,computer-based learning,cbl,cal,business
communications,editing,book reviews,online
learning,word-processors,typography,information technology,web
design,educational software,notas en espanol,htm,html,style
sheets,css,xml,xhtml,free notes,guidance notes,ebooks,e-books,free
ebooks,electronic books,electronic publishing,free software,free fonts,free
newsletter,dictionaries,bibliographies,reports,journalism,composition,w ritin
g guides,literary studies,free tutorials,english literature" />
<link rel="stylesheet" href="/style/styleX.css"
type="text/css" /><!-- #EndEditable -->
</head>
................
</html>







------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to