[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: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 08 Jun 2010 21:14:25 +0100
Re:  Recursive function referencing an XML file
I think it's probably cleanest if all the inputs to a function are explicit in the parameters you pass. So pass the root node of the library XML document as a parameter, rather than calling doc() from within the function. It probably won't make much difference to performance (though performance depends on the product you are using), but it feels right in terms of making your code modular and reusable.

Michael Kay
Saxonica

On 08/06/2010 19:57, Mario Madunic wrote:
This is more of a programming technique question than a how to.

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. 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.

So my question is,

What is the best method to call the library XML file? As a parameter into the function (placing the content of the library into a variable that is placed into the function), a straight<value-of select="doc('file:///pathto/library.xml')..." /> each time the function is called, or does it really matter as it might make no difference or discernable difference? (I'll be parsing 400+ files all less than 30k.)

Just trying to find the best method someone with a programming background and education (read post secondary education in computer science) would use.

Marijan (Mario) Madunic
Publishing Specialist
New Flyer Industries

--------------------------------------------------------------------
Please consider the environment before printing this e-mail.

CONFIDENTIALITY STATEMENT: This communication (and any and all information or material transmitted with this communication) is confidential, may be privileged and is intended only for the use of the intended recipient. If you are not the intended recipient, any review, retransmission, circulation, distribution, reproduction, conversion to hard copy, copying or other use of this communication, information or material is strictly prohibited and may be illegal. If you received this communication in error or if it is forwarded to you without the express authorization of New Flyer, please notify us immediately by telephone or by return email and permanently delete the communication, information and material from any computer, disk drive, diskette or other storage device or media. Thank you.

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.