[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: substrings and identical numbers

Subject: Re: substrings and identical numbers
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 9 May 2001 18:48:20 +0100
after and before numbers
Hi Tobi,

> <!-- I need to get the first three places. They can be of any
> length. Why does only the second one work like expected? The first
> one doesn't work if the two numbers are the same. (uncomment one
> then the other) -->

Just to explain why the first one doesn't work, take the string:

  a_a_7000_7000

You have the expression:

   substring-before($input,
                    substring-after(
                       substring-after(
                          substring-after($input, '_'), '_'), '_'))

Substituting in the $input:

   substring-before('a_a_7000_7000',
                    substring-after(
                       substring-after(
                          substring-after('a_a_7000_7000', '_'),
                          '_'), '_'))

Evaluating the inner-most substring-after():

   substring-before('a_a_7000_7000',
                    substring-after(
                       substring-after('a_7000_7000', '_'), '_'))

Evaluting the inner-most substring-after():

   substring-before('a_a_7000_7000',
                    substring-after('7000_7000', '_'))

And evaluating that last substring-after():

   substring-before('a_a_7000_7000', '7000')

The substring-before() function finds the first occurrence of the
second argument string in the first argument string, and returns the
string that occurs before it.  The first occurrence of the string
'7000' in the string 'a_a_7000_7000' is the first '7000' in that
string, so the substring-before() is:

  'a_a_'

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.