Re: [xsl] passing parameters to generic templates

Subject: Re: [xsl] passing parameters to generic templates
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 10 Apr 2006 23:19:19 +0100
<xsl:template match="/">
so here your context node is /
   <test>
     <xsl:apply-templates select="/content/para">
so this could be written  select="content/para">
as you are already at / no ned to make that explicit (no harm either)
       <xsl:with_param name="path" select="docBase"/>
and this selects all the docBase children of / which is the empty set
(or sequence if you are using 2.0). You want select="content/docBase

or perhaps moresimply change the template to match on content rather
than / and have

<xsl:template match="content">
   <test>
     <xsl:apply-templates select="para">
       <xsl:with_param name="path" select="docBase"/>
     </xsl:apply-templates>
   </test>
</xsl:template>

You don't need to explicitly pass this parameter down the templates, you
could just make it a global variable defined at the top level (outside
any template) as
<xsl:variable name="path" select="content/docBase"/>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread