Middle of word

N

N9

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
 
K

Ken Starks

N9 said:
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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top