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

Use of global variable and parameter

Subject: Use of global variable and parameter
From: "Vivek Shinde" <Vivek.Shinde@xxxxxxx>
Date: Fri, 4 Jun 2004 00:29:12 -0400
xsl variable global
Hi,

I have first XSL as follows: 

<?xml version="1.0" encoding="UTF-8"?>

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

	<xsl:variable name="forcountry" select="GB"/>
	<xsl:include href="secondxsl.xsl"/>

</xsl:stylesheet>

Then withing secondxsl.xsl I am using a variable 'forcountry' within one of the template as:

<?xml version="1.0" encoding="UTF-8"?>

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

<xsl:template match="article" mode="details-introduction">
<xsl:if test="metadata[countryname=$forcountry]">
..........
..........
</xsl:if>
</xsl:template>
</xsl:stylesheet>

But, it seems that the value of forcountry is blank within secondxsl.xsl.
I understand that the global variable definition works only within a stylesheet (I tried defining xsl:variable within the secondxsl.xsl right after xsl:output and it still does not work). But in Michael Kay's book 'XSLT 2nd edition' on page 83 it states 'Global parameters are set from outside the stylesheet' (last paragraph), so I tried changing 'xsl:variable' to 'xsl:param' and it still does not work.

Any help please?
Thanks
Vivek

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.