Subject: Re: [xsl] Parent Node recursion template fails From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 08 Feb 2012 23:05:06 +0000 |
because you have used parent::node() (which could more simply be written as ..) rather than parent::* then if it doesn't find the $node-id it will reach / and then (because your template only matches * not /) it will apply the default template to / which will apply templates to its element child, hitting this template again and looping forever. cahanging the match to "*|/" should fix it.This recursion template is failing. I'm getting the error, too many recursions... I would expect that when I get to the root element it would stop recursing. I guess I need a test for root element. Karl..
<xsl:template match="*" mode="navigation-special_paint-selected"> <xsl:param name="node-id"/> <xsl:choose> <xsl:when test="generate-id() = $node-id"> <xsl:attribute name="background">#eee</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="parent::node()" mode="navigation-special_paint-selected"> <xsl:with-param name="node-id" select="$node-id"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:template>
-- google plus: https:/profiles.google.com/d.p.carlisle
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Parent Node recursion tem, Wendell Piez | Thread | Re: [xsl] Parent Node recursion tem, Wendell Piez |
Re: [xsl] Parent Node recursion tem, Wendell Piez | Date | Re: [xsl] Parent Node recursion tem, Wendell Piez |
Month |