Closed noisy closed 8 years ago
Could you help me figure out how this call should look like?
xidel tesla.xml -e "/document/offers/offer/concat(price/text(), for $r in . return 'default-value'[not($r/price/text())])"
On linux you would need \$ or swap the quotes :
xidel tesla.xml -e '/document/offers/offer/concat(price/text(), for $r in . return "default-value"[not($r/price/text())])'
Is it Xpath 3 or 2?
It is XPath 2
In XPath 3 you could use let $r := return ...
Although it is a really weird approach. You can just use if:
xidel tesla.xml -e "/document/offers/offer/(if (price/text()) then price/text() else 'default-value')"
And drop the text. In the default settings it only shows text anyways:
xidel tesla.xml -e "/document/offers/offer/(if (price) then price else 'default-value')"
And then you can swap it back, but get the first:
xidel tesla.xml -e "/document/offers/offer/(price, 'default-value')[1]"
On website http://videlibri.sourceforge.net/cgi-bin/xidelcgi
I found that query:
/document/offers/offer/concat(price/text(), for $r in . return 'default-value'[not($r/price/text())])
returns:
for this xml
right now I am trying to construct arguments for
xidel
installed on my local machine, but I have problem with that.Could you help me figure out how this call should look like? Is it Xpath 3 or 2?