[Home] [By Thread] [By Date] [Recent Entries]
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 times. 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.
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" David ________________________________________________________________________ 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. ________________________________________________________________________
|

Cart



