stringtextxpathliterals

Append literal string (plain text) to XPath result


Is there a way to append a literal string to whatever an XPath expression gets you?

e.g. from following XML:

<root>
    <select>I am</select>
</root>

I would like to produce:

I am a literal

purely with XPath. What do I add to /root/select to get what I want? Important: XPath 1.0 solution required! I'm not using XSLT.


Solution

  • Any reason you can't simply concat() 'a literal' to the end?

    Something like this? =>

    concat( string(/some/selector) , ' some literal' )