I trying to parse a string in an XML node by using an XPath query which requires that I strip out a substring and read the remaining value. The substring may have a dynamic amount of whitespace before and after it before I can get to the value, so it would be helpful to have some sort of a indexOf function to use in the XPath. I'm trying to use substring-after, but there is a good chance the XPath is 1.0, which according to this post might make this more difficult to accomplish. The following is an example of the XML I am trying to parse:
<root>
<myField> StringToParse 7</myField>
</root>
I'm trying to get at the value 7 in the string, which would seem possible with some combination of substring-after and normalize-space. I'm not entirely sure I'm using it correctly because no matter which way I try to use it, the result is either a null value or the entire string, with the substring not removed.
The way I am able to return the entire value (the lesser of two evils) is: /myField[substring-after(.,'StringToParse')], which I would hope would return ' 7' Could anyone let me know I'm doing wrong with the syntax, or if there is an alternate method I should be using to accomplish what I want?
Thanks,
Mike