Is there a trim function in XPath 1.0, that can be used like this:
.//a[trim(.) = @href)]
?
As I say, XPath is not a string-handling mechanism; it cannot remove spaces. It is concerned solely with the retrieval of data. Anything you want to do TO that data must be done separately, and currently we don't know what language you're using to do that in.
XPath/XQuery normalize-space function Returns the value of $arg with leading and trailing whitespace removed, and sequences of internal whitespace reduced to a single space character.
The normalize-space(String s) method is used to normalize a string i.e. to remove any leading or trailing spaces from the string s passed as parameter to the XPath function.
There is normalize-space()
, which does a little more than trimming, but which may be fine for URLs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With