Re: [xsl] Recursive call trouble

Subject: Re: [xsl] Recursive call trouble
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 9 Aug 2006 21:08:25 +0100
<xsl:param name = "start">1</xsl:param>
<xsl:param name = "end">60</xsl:param>
<xsl:param name = "ln">1</xsl:param>


these are global parameters so they are usable in all templates but they
will always have these values. Incidentally it's much better to use teh
selct attribute on xsl:param or xsl:variable




<xsl:param name = "start" select="1"/>

would make $start be the number 1, instead of a result tree fragment
consisting of a root node with a child text node with value  the string
"1".


<xsl:template match="fdoc/bl/title" name="intro">
You want the parameters to be parameters of this template so move them
after this line.
This template will match title elements so (if you apply templates to
title elements) it will be executed with teh current node being title.

		<xsl:variable name = "num"
select="string-length(fdoc/bl/title/para/text())" />

This selects the flfoc/title/bl/title/para/text() decendent of teh
current title node,which I suspect is empty and you just want
		<xsl:variable name = "num" selct="string-length(.)" />
here (and other places where this xpath is used.





			<line number='$ln'>
you want 
			<line number='{$ln}'>
here otherwise each attribute will get the literal string $ln with the
{} syntax the expression will be evaluated

David

Current Thread