[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl:variable question

Subject: RE: xsl:variable question
From: "Oleg Tkachenko" <olegt@xxxxxxxxxxxxx>
Date: Thu, 20 Dec 2001 00:10:11 +0200
RE:  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@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Long Zhao
> Sent: Wednesday, December 19, 2001 11:28 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.