RE: [xsl] how to pass parameters down through nested templates using xsl:apply templates in a nested fashion?

Subject: RE: [xsl] how to pass parameters down through nested templates using xsl:apply templates in a nested fashion?
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 10 Sep 2003 23:57:32 +0100
> Now I am curious if there is a way to pass that Incoming 
> Parameter down to the next templates as my outgoing parameter?

Of course. <xsl:with-param name="x" select="$x"/>

Michael Kay


> 
> If I can use a "local" variable to store the incoming 
> parameter and then output it, then how can I do that? Please 
> show me with a small code sample.
> 
> I appreciate all your help. If you do know a way or have any 
> ideas or a web link for tutorial/discussion that will help me 
> do so please let me know.
> 
> Thanks,
> 
> Abhishek
> 
> COMPLETE CODE ATTACHED BELOW:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> xmlns:fo="http://www.w3.org/1999/XSL/Format";>
> 
> <xsl:template match="Matrix">
> <xsl:param name="HeadAlign" select="Right"/>
> <xsl:param name="DataAlign" select="Right"/>
> 
> 	<xsl:if test="contains(@HeadFlow,'H')">
> 		<font class="debug">Horizontal</font>		
> 
> 		<table border="0">
> 			<xsl:apply-templates mode="H">
> 			<xsl:with-param name="HeadAlign"
> select="Center"/>
> 			<xsl:with-param name="DataAlign"
> select="Center"/>
> 			</xsl:apply-templates>
> 		</table>
> 	</xsl:if>
> 
> 	<xsl:if test="contains(@HeadFlow,'V')">
> 		<font class="debug">Vertical</font>
> 
> 		
> 		<table border="0">
> 			<xsl:apply-templates mode="V">
> 			<xsl:with-param name="HeadAlign" select="Left"/>
> 			<xsl:with-param name="DataAlign" select="Left"/>
> 			</xsl:apply-templates>
> 		</table>
> 	</xsl:if>
> 
> </xsl:template>
> 
> <xsl:template match="MatrixHeadArray" mode="H">
> <xsl:param name="HeadAlign" select="Right"/>
> <xsl:param name="DataAlign" select="Right"/>
> 	<tr align="{$HeadAlign}">
> 		<xsl:apply-templates mode="H">
> 		<xsl:with-param name="HeadAlign" select="{$HeadAlign}"/>
> 		<xsl:with-param name="DataAlign" select="{$DataAlign}"/>
> 		</xsl:apply-templates>
> 	</tr>
> </xsl:template>
> 
> <xsl:template match="MatrixHeadCell" mode="H">
> <xsl:param name="HeadAlign" select="Right"/>
> <xsl:param name="DataAlign" select="Right"/>
> 	<th align="{$HeadAlign}">
> 		<xsl:apply-templates/>
> 	</th>
> </xsl:template>
> 
> <xsl:template match="MatrixDataArray" mode="H">
> <xsl:param name="HeadAlign" select="Right"/>
> <xsl:param name="DataAlign" select="Right"/>
> 	<tr align="{$DataAlign}">
> 		<xsl:apply-templates mode="H">
> 		<xsl:with-param name="HeadAlign" select="{$HeadAlign}"/>
> 		<xsl:with-param name="DataAlign" select="{$DataAlign}"/>
> 		</xsl:apply-templates>
> 	</tr>
> </xsl:template>
> 
> <xsl:template match="MatrixDataCell" mode="H">
> <xsl:param name="HeadAlign" select="Right"/>
> <xsl:param name="DataAlign" select="Right"/>
> 	<td align="{$DataAlign}">
> 		<xsl:apply-templates/>
> 	</td>
> </xsl:template>
> 
> <xsl:template match="MatrixHeadArray" mode="V">
> <xsl:param name="HeadAlign" select="Right"/>
> <xsl:param name="DataAlign" select="Right"/>
> 	<xsl:for-each select="MatrixHeadCell">
> 		<tr>
> 			<th align="{$HeadAlign}">
> 				<xsl:apply-templates/>
> 			</th>
> 			<xsl:variable name="headloc">
> 				<xsl:value-of select="@i"/>
> 			</xsl:variable>
> 			<xsl:for-each select="../../MatrixDataArray">
> 				<td align="{$DataAlign}">
> 					<xsl:apply-templates 
> select="MatrixDataCell[@i=$headloc]"/>
> 				</td>
> 			</xsl:for-each>
> 		</tr>
> 	</xsl:for-each>
> </xsl:template>
> 
> <xsl:template match="MatrixDataCell" mode="V"/>
> <xsl:param name="HeadAlign" select="Right"/>
> <xsl:param name="DataAlign" select="Right"/>
> 
> </xsl:stylesheet>
> 
> Abhishek Sanwal
> HP - Houston Campus
> abhishek.sanwal@xxxxxx
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread