N9 wrote:
Hi
It's possible to substring middle ??
text = "Here are a story about a boy, who like to play baseball"
I split on word "who", with 10 char to left and 10 char til right,
that the result gone be.
text = "out a boy who, like to "
Hope some one could help me.
Thanks
//N9
You should look up XPath rather than XSLT, and you will
want the string functions:
substring-before, substring-after, substring, string-length
and possibly 'concat' and 'contains'
for example:
substring(substring-after("Here is a story about a boy, who likes to
play baseball","who"),4,11)
evaluates to 'kes to play'
Note that the second parameter is a request for a length od substring,
not the final position.
Assuming the source text is the content of an xml element, you would use
<xsl:value-of>, possibly normalise spaces, and almost certainly wish to
use a variable.
Also not thet the 'substring-before' and 'substring-after' functions
only return the first match,