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

RE: calling template with parameters

Subject: RE: calling template with parameters
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 9 Jan 2001 13:27:11 -0000
newslist template rss
> I have a problem passing a parameter.
> 
> Why is the parameter in template "newslist" empty??

Because built-in templates do not pass their parameters through unchanged.
Your shownews template rule calls the newslist template rule via the
built-in rule for the root node. Change it to
"document('news/news.xml')/newlist" and all will be well.

Mike Kay
> 
> 
> 	<xsl:template match="shownews">
> 		<xsl:variable name="count" select="@count"/>
> 		Here it works: <xsl:value-of select="$count"/>	
> 		<xsl:apply-templates select="document('news/news.xml')">
> 			<xsl:with-param name="newscount" 
> select="$count"/>
> 		</xsl:apply-templates>  
> 	</xsl:template>
> 	<xsl:template match="newslist">
> 		<xsl:param name="newscount"/>		
> 		now newscount is empty: <xsl:value-of 
> select="$newscount"/>
> 		<!-- At this point, I want to process 
> $newscount elements of
> 		type <news>, but the parameter newscount is empty.-->
> 	</xsl:template>
> 
> 
> ### news/news.xml ###
> <newslist>
> 	<news id="123">
> 		<title>important news</title>
> 		<created>18.12.2000</created>
> 		<expires/>
> 		<content>foo</content>
> 		<created_by>rh</created_by>
> 	</news>
> </newslist>
> #####################
> 
> 
> Thanks,
> Roman
> 
>  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.