How can XPath expressions select text child nodes?

Tags: #<Tag:0x00007f61657ea540> #<Tag:0x00007f61657ea3b0>

Hi all,
I try to use an XPATH expression to select a text child value from the following XML

    <?xml version="1.0" encoding="utf-8"?>
    <eta version="1.0" xmlns="">
       <value uri="/user/var/40/10201/0/0/12015" strValue="2431" unit="kg" decPlaces="0" scaleFactor="10" advTextOffset="0">24311</value>

The result I’m looking for is “24311”.
In the XPath evaluator I tried (Link) the expression “/eta/value/text()” worked well. Unfortunately, neither In an OH 2.4 script, nor in an HTTP tranformation I got a result but “” :frowning:
If i change the same expression to “/eta/value/@scaleFactor” it works, but that’s not what I’m looking for…

Any idea what I’m doing wrong?

Thanks for your help

Can you post these, please?

sure, but it’s too simple:

For the item:

String Test "Result [%s]" { http="<[http://...:60000:XPATH(/eta/value/text())]" }

And inside a rule:

var xml = sendHttpGetRequest("http://.....")
var result = transform("XPATH","/eta/value/text()", xml)

By the way, I solved it with a regexp. But it feels bad and selecting text nodes from XML could be useful in later cases.

I don’t think you need the text(). Does /eta/value work?

No, it doesn’t work. Without /text() it selects the entire element “value” including attributes and so on.