+1 to the "3" in @id

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

Re: given @id="1.2.3" .... -1 || +1 to the "3" in @id

Subject: Re: given @id="1.2.3" .... -1 || +1 to the "3" in @id??
From: "Christopher R. Maden" <crism@xxxxxxxxx>
Date: Mon, 02 Jul 2001 21:33:57 -0700
Re:  given @id="1.2.3" .... -1 || +1  to the "3" in @id
At 11:20 2-07-2001, Anthony E. wrote:
the sections for the prev & next links are in
different xml files, so I can't use xpath to determine
if it's the first or last element. I will have an
attribute first="1.1.1" and last="1.1.3" in each
<section> element. Then I can compare if the current
"id" attribute is equal to first or last and determine
whether or not there is a prev or next link.

OK. Then the other suggestions on this thread ought to work. If there are always two periods, then you can use


substring-after(substring-after(@id,'.'),'.')

to get the part after the last dot; to build the entire number for the next part, it'll look like (the rather complicated):

concat(
  substring-before(@id,'.'), '.',
  substring-before(substring-after(@id,'.'),'.'), '.',
  number(substring-after(substring-after(@id,'.'),'.'))+1
)

If you don't know how many subparts there will be, then you need to use recursive templates to continue stripping as long as there are periods left in the string.

-Chris
--
Christopher R. Maden, XML Consultant
DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
<URL: http://crism.maden.org/consulting/ >
PGP Fingerprint: BBA6 4085 DED0 E176 D6D4  5DFC AC52 F825 AFEC 58DA


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.