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

Re: Recursive function referencing an XML file, best

Subject: Re: Recursive function referencing an XML file, best programming technique
From: Liam R E Quin <liam@xxxxxx>
Date: Wed, 09 Jun 2010 12:17:38 -0400
Re:  Recursive function referencing an XML file
On Tue, 2010-06-08 at 13:57 -0500, Mario Madunic wrote:
> This is more of a programming technique question than a how to.

Others have answered your question, but a couple of other thoughts...

> I'll be creating a recursive function in XSLT that will manipulate a
> tokenized string (on spaces), capitalize initial letter in each word
> and lower case the rest of the word.

Hmm, you can do this with analyze-string and avoid the recursion in most
cases - maybe you're using XSLT 1? You'd still need to write a
template/function to change the first character to its upper-case
equivalent. You can use upper-case() as a first approximation.

(One ought also to be able to do it with "replace" but we did not
include \u \U \l and \L support in the spec, alas.)

>  An issue arises for product names and acronyms, as the way they are
> spelt is quite specific. So I'll create a library XML file that will
> contain the correct spelling for these strings and do a check on each
> string.

If they are really strings, with no embedded elements (e.g. you are not
dealing with Japanese Ruby here, or fragments of mathematics), you can
use XSLT's key() mechanism to make the lookup reasonably fast.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org

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.