Posted by: peteinman | December 2, 2009

Oracle Service Bus – fn:tokenize

If you have a string, such as a file name which looks like


How do you get the filename without the extension?

Use the following XQuery function

fn:tokenize(‘FileName.txt’, ‘\.’)[1]

That function will get the first element of the tokenized array.

Note that the escaped “.” is important otherwise you won’t get anything returned.

fn:tokenize(‘FileName.txt’, ‘\.’)[last()]

will return the last element, in this case “.txt” and you can also do last()-1 to get the previous element.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: