[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: mode computation case
On 03/09/2010 03:16, ac wrote:
<xsl:template name="dispatch"> ... <xsl:choose> <xsl:when test="@mode eq 'mode1'"><xsl:apply-templates select="$nodetree" mode="mode1"></xsl:when <xsl:when test="@mode eq 'mode2'"><xsl:apply-templates select="$nodetree" mode="mode2"></xsl:when <xsl:when test="@mode eq 'mode3'"><xsl:apply-templates select="$nodetree" mode="mode3"></xsl:when <xsl:when test="@mode eq 'mode4'"><xsl:apply-templates select="$nodetree" mode="mode4"></xsl:when <xsl:when test="@mode eq 'mode5'"><xsl:apply-templates select="$nodetree" mode="mode5"></xsl:when <xsl:when test="@mode eq 'mode6'"><xsl:apply-templates select="$nodetree" mode="mode6"></xsl:when <xsl:otherwise><xsl:apply-templates select="$nodetree" mode="modeX"></xsl:otherwise> </xsl:choose ... <xsl:template> As has been said earlier in the thread, a template consisting mainly of a top level xsl:choose can almost always be usefully split up into separate templates, so here you can replace here your dispach template is just implementing choosing code based on a mode attribute, ie it's implementing apply-templates "by hand" so things look simpler if you use apply-templates and let the xslt engine handle the dispaching. replace xsl:call-template name="dispatch"> by <xsl:apply-templates select="@mode"> and have <xsl:template match="@mode[.='mode5']"> <xsl;param name="nodetree" tunnel="yes"/> <xsl:apply-templates select="$nodetree" mode="mode5"/> </xsl:template> ________________________________________________________________________ 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. ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|