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

Re: Suggestions to improve my XSL writing style

Subject: Re: Suggestions to improve my XSL writing style
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 28 Jan 2011 09:27:25 +0000
Re:  Suggestions to improve my XSL writing style
On 28/01/2011 08:20, Jacobus Reyneke wrote:
The XSL I wrote below works, but I'm looking for ways to improve my
coding style. Is this a bad way of writing style sheets? - in
particular the fact that I call "apply-templates" about a million

The usual error of beginners is that they don't use apply-templates enough and over use for-each and value-of. apply-templates is the heart and soul of xslt, the more times it's used the merrier.

Also, I could not get the Act numbering to be added in the Scene title, so I left it in the Act element, where I would have liked a Scene title like "Act 1, Scene 1" but using position() from within the scene match gave me strange numbering.

if you just use <xsl:apply-templates/> that means select="node() so selects all nodes includng he white space text nodes between elements and so position() probably went up in steps of two. You could use
<xsl:apply-templates select="scene"/> in your act template 9if scenes are the only child type) then the sequence being processed will just have scenes and position() will reflect the scene number. but probably better would be to use xsl:number from="act" count="scene"


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________

Current Thread


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.
First Name
Last Name
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.