Subject: Re: Recursive call trouble
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 10 Aug 2006 10:41:13 +0100
|
> I've made some changes according to what you've
> provided. Now when the template is called I'm getting an unknown XSLT
> error.
unknown to the system or unkonown to you? (It's best to quote the error
exactly)
> I'm using Xalan as my parser.
Xalan is not a parser, you are probably using xerces as your parser,
xalan is the XSLT engine.
> <!-- How I'm trying to start the Recursive call -->
> <xsl:template match="floordoc">
> ...
a match template only says what to do if you applly templates to a
matching node, it doesm't by itself, cause any code to run.
<!-- The modified Recursive call -->
<xsl:template match="floordoc/bill/title" name="intro">
unless you have title elements in other places you can probably just
write
<xsl:template match="title" name="intro">
<xsl:variable name="num" select="string-length(.)" />
when I suggested to use . here I was assuming that you were starting off
by applying templates to a title element and this templat ewill fire
becuase of the match attribute, in which case the current element would
be title and . would do the right thing, but for some reasdon you are
calling this by name from your floordoc template so in that case
the current node is floordoc. so . would select teh floordoc element not
title. I suspect you want to keep . here but get rid of teh
call-template in the floordoc template.
<xsl:value-of select="substring(floordoc/bill/title/para/text(),
If the current node is title (or even if it is floordoc) then the xpath
floordoc/bill/title/para/ will select nothing unless the current elemnt
has a floordoc child. You want . here.
<xsl:value-of select="substring(floordoc/bill/title/para/text(),
same again
David
|