Jump to content

access XHTML tree with XPath


domingoazul

Recommended Posts

Hello,I would like to change a value of my xhtml document using XPath.This is a summary of my document:

<?xml ....?><html ....>  <head>	...  </head>  <body>	...	<object>	  <param name="..." value="..." />	</object>  </body></html>

I use this XPath argument: "/html/body/object/param/@value" but it does not work.The element who uses this XPath argument is an xforms:setvalue like this:

<xforms:setvalue ref="/html/body/object/param/@value" value="instance('appletData')/ws:docRoute" />

I can do something near of what I want with Javascript, but I do not know ho to do it with XPath.Thanks

Link to comment
Share on other sites

Do you have a namespace declared in the XHTML? That is:

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

If so, your XPath expression needs to specify that by using:

"/{http://www.w3.org/1999/xhtml}html/{http://www.w3.org/1999/xhtml}body/{http://www.w3.org/1999/xhtml}object/{http://www.w3.org/1999/xhtml}param/@value"

You can also simply remove the xmlns though.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...