Given a form number like:
ABC_12345_Q-10
I want to end up with:
ABC12345
So I need to find the position o
@Pavel_Minaev has provided XPath 1.0 amd XPath 2.0 solutions that work if it is known in advance that the number of underscores is 2.
Here are solutions for the more difficult problem, where the number of undrscores isn't statically known (may be any number):
XPath 2.0:
translate(substring($s,
1,
index-of(string-to-codepoints($s),
string-to-codepoints('_')
)[last()] -1
),
'_',
''
)
XSLT 1.0:
when this transformation is applied to any XML document (not used), the desired, correct result is produced:
ABC12345