In XPath how to select the element content

element, xpath

Solution

Use the `value-of` element:

<xsl:value-of select="/Some/Path/To/Element"/>

If you can only specify an XPath then use the `text` function like this:

`/Some/Path/To/Element/text()`

Problem

Is there a way of writing an XPath expression to select the content of the element. e.g. ``` <Element>xxx</Element> ``` Assuming I can write XPath (/Element) to get `Element` how do I tweak the XPath to get xxxx returned rather than the Element wrapper? EDIT/ANSWER To do this in dom4j world use the `Element.valueOf(String xpathExpression)` rather than the .selectXXX() methods.

Original source