RE: [xsl] access of a param

Subject: RE: [xsl] access of a param
From: aruniima.chakrabarti@xxxxxxxxxxxxxxxxxx
Date: Tue, 6 Aug 2002 20:42:28 +0530
Hi Vasu,
Thanks for ur help.. But my problem is that in the following in code I want
to access variable "anchor" which is present in the last template as a
parameter to the onclick event of the tr element... any ways of doing it???


<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; >

<xsl:param name="start_point" select="1"/>
<xsl:param name="num_col" select="count(//Header)"/>	
<xsl:param name="row_offset" select="10"/>	

<xsl:template match="/">

<html>
<head>
	<title>PickList</title>
</head>
<body>

	<table STYLE="font-family:Verdana, Arial; font-weight:normal;
font-size:9pt; background:#888888 border:1px solid #000000">
		<tr style="background-color:#E6EDF9; border-bottom:0.02cm
solid #663300; border-right:0.02cm solid white" HEIGHT='25'>
		<xsl:for-each select="//Header">
			<td STYLE="font:normal normal 8pt Verdana"><font
color="#990000"/><xsl:value-of select="ColHdr" /></td>
		</xsl:for-each> 
		</tr>

		<xsl:call-template name="dis_rows">
			<xsl:with-param name="num_nodes"
select="$start_point"/>
		</xsl:call-template>	

	</table> 
</body>
</html>
</xsl:template>

<xsl:template name="dis_rows">
<xsl:param name="num_nodes"/>	
	<xsl:if test="$num_nodes != $start_point + $row_offset">
	<tr STYLE="font:normal normal 9pt Verdana"
onmouseover="this.style.color='red';this.style.cursor='hand'"
onmouseout="this.style.color='black'">

		<xsl:call-template name="display_columns">
			<xsl:with-param name="col_num" select="1"/>
			<xsl:with-param name="row_num" select="$num_nodes"/>
			<xsl:with-param name="anchordata" select="''"/>
		</xsl:call-template>

	</tr>

		<xsl:call-template name="dis_rows">
			<xsl:with-param name="num_nodes" select="$num_nodes
+ 1"/>
		</xsl:call-template>
	</xsl:if> 
</xsl:template>

<xsl:template name="display_columns">
<xsl:param name="row_num"/>	
<xsl:param name="col_num"/>
<xsl:param name="anchordata"/>

	<xsl:choose>
    
        <xsl:when test="$col_num != $num_col + 1">

        <xsl:variable name="coldata"
select="//Data[position()=$row_num]/Columns[position()=$col_num]/Col"/>	
        <td>

		<xsl:if test="$row_num mod 2 != 0">
			 <xsl:attribute name="bgcolor"><xsl:value-of
select="'white'"/></xsl:attribute> 
		</xsl:if> 	
		<xsl:if test="$row_num mod 2 = 0">
			    <xsl:attribute name="bgcolor"><xsl:value-of
select="'#FFF5D7'"/></xsl:attribute> 
		</xsl:if> 	
		<xsl:value-of select="$coldata"/>	

	</td>
		<xsl:call-template name="display_columns">
			<xsl:with-param name="col_num" select="$col_num +
1"/>
			<xsl:with-param name="row_num" select="$row_num"/>
               		<xsl:with-param name="anchordata"
select="concat('|',$coldata)"/>
		</xsl:call-template>
    	</xsl:when> 
    </xsl:choose>

	    <xsl:variable name="anchor" select="$anchordata"/>
</xsl:template>
</xsl:stylesheet>


Regards,
aruniima

-----Original Message-----
From: Vasu Chakkera [mailto:vasucv@xxxxxxxxxxx]
Sent: Tuesday, August 06, 2002 8:22 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] access of a param

>  How can access the value of a parameter, which is within some template...
The following example shows how the templates are called with parameters and
how they are received at the called template..
note that the variable can be passed as a parameter to another template

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="/">
<xsl:variable name="myVar" select="'1'"/>
<xsl:apply-templates select="/myroot/myElement">
<xsl:variable
<xsl:with-param name="myParam" select="$myVar"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="myElement">
<xsl:param name="myParam"/>
**Param Value**
<xsl:value-of select="$myParam"/><br/>
</xsl:template>
</xsl:stylesheet>

Hope this helps
Vasu

>From: aruniima.chakrabarti@xxxxxxxxxxxxxxxxxx
>Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject: [xsl] access of a param
>Date: Tue, 6 Aug 2002 19:59:53 +0530
>
>
>Hello Everyone,
>  How can access the value of a parameter, which is within some template...
>I
>am using recursive call to templates to calculate a value. I want to access
>the value outside that template... how can I do so??? Please help...
>
>Regards,
>aruniima
>
>---------------------------------------------------------------------------
-
>
>This message contains privileged and confidential information and is
>intended only for the individual named. If you are not the intended
>recepient you should not disseminate, distribute, store, print, copy or
>deliver this message. Please notify the sender immediately by e-mail if you
>have received this e-mail by mistake and immediately delete this e-mail
>from
>your system.
>
>
>E-mail transmission cannot be guaranteed to be secure or error-free as
>information could be intercepted, corrupted, lost, destroyed, arrive late
>or
>incomplete, or contain viruses. The sender therefore does not accept
>liability for any errors or omissions in the contents of this message which
>arise as a result of e-mail transmission.  If verification is required
>please request a hard-copy version.
>
>
>--------------------------------------------------------------------------
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


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

This message contains privileged and confidential information and is
intended only for the individual named. If you are not the intended
recepient you should not disseminate, distribute, store, print, copy or
deliver this message. Please notify the sender immediately by e-mail if you
have received this e-mail by mistake and immediately delete this e-mail from
your system.


E-mail transmission cannot be guaranteed to be secure or error-free as
information could be intercepted, corrupted, lost, destroyed, arrive late or
incomplete, or contain viruses. The sender therefore does not accept
liability for any errors or omissions in the contents of this message which
arise as a result of e-mail transmission.  If verification is required
please request a hard-copy version.


--------------------------------------------------------------------------

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


Current Thread