This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: xsl:variable question


you are right on the first comment
for your second comment, since the variable is declared in top level
template, so you do not need to pass the para when calling "dosomething"

thanks

Long

-----Original Message-----
From: Oleg Tkachenko [mailto:olegt@multiconn.com]
Sent: Wednesday, December 19, 2001 5:10 PM
To: xsl-list@lists.mulberrytech.com
Subject: RE: [xsl] xsl:variable question


Hello Long!

choose

1. Machine answer: Your second stylesheet is ill-formed because of wrong
</template> end-tag, it's probably </xsl:template>.

2.Both stylesheets will not work because of unresolved variable
reference in the template named "dosomething".
If you want $mode in the second template, pass it as parameter:
<xsl:template match="/">
	<xsl:variable name="mode">1</xsl:variable>
	<xsl:call-template name="dosomething">
		<xsl:with-param name="mode" select="$mode"/>
	</xsl:call-template>
	......
</xsl:template>
	<xsl:template name="dosomething">
	<xsl:param name="mode"/>
	<xsl:if test="$mode='1'">
		.....
	</xsl:if>
	.....
</xsl:template>

---
Oleg Tkachenko,
Multiconn International, Israel 

> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com 
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Long Zhao
> Sent: Wednesday, December 19, 2001 11:28 PM
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] xsl:variable question
> 
> 
> hi everyone
> 
> here are two xsl files :
> 
> <xsl:template match="/">
> 	<xsl:variable name="mode">1</xsl:variable>
> 	......
> </xsl:template>
> 
> <xsl:template name="dosomething">
> 	<xsl:if test="$mode='1'">
> 		.....
> 	</xsl:if>
> 	.....
> </template>
> ------------------------------------
> <xsl:template match="/">
> 	<xsl:variable name="mode" select='1'/>
> 	......
> </xsl:template>
> 
> <xsl:template name="dosomething">
> 	<xsl:if test="$mode='1'">
> 		.....
> 	</xsl:if>
> 	.....
> </template>
> 
> why the first one does not work, but the second one works.
> 
> am i doing anything wrong in the first xsl?
> 
> thanks
> 
> Long
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]