Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 4th, 2006, 12:54 AM
Authorized User
 
Join Date: May 2006
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default accessing variables in templates

hi I have an xsl with a variable declared the thing is i want this variable to be accesses in a template kept in another xsl file. and also this value should be got in the original file as well
here is an example
Code:
<xsl:for-each .../>
<xsl:variable name="level1" select="position()"/>
<xsl:call-template name="Level2Template/> 

</xsl:for-each/>

<xsl:template name="">
<xsl:for-each .../>
<xsl:variable name="level2" select="postion()">
<img name="{$level1}{$level2} .../><!-- thats why i need level1's value
Also the level2 value is needed in the main program to go further down the loop-->
-->
</xsl:for-each/>
</xsl:templae>
Thanks fr the help



 
Old May 4th, 2006, 03:16 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Please do your readers the courtesy of writing in whole sentences with capital letters and full stops.

You can pass parameters from one template to another. Use xsl:with-param within the xsl:call-template to supply the parameter, and xsl:param within the xsl:template to receive it.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing server variables badgolfer Classic ASP Professional 2 October 23rd, 2007 03:11 AM
Dynamically accessing ASP variables jordan147 Classic ASP Basics 1 May 21st, 2007 02:09 AM
Accessing Session Variables in javascript subhendude Other Programming Languages 1 November 8th, 2006 11:15 AM
Changing variables in match templates chicken XSLT 0 September 11th, 2006 10:26 AM
Accessing Session variables from custom class mohyneenm ASP.NET 1.0 and 1.1 Professional 2 January 26th, 2005 07:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.