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

Resetting Parameters

Subject: Resetting Parameters
From: "Shane Sawyer" <shanesawyer@xxxxxxxxxxx>
Date: Wed, 09 Apr 2003 09:26:17 +0000
shane sawyer
What I'm trying to do is pick up a value i.e. (Environment) from the start of my XML File and use that value in another template.

Basically in development terms I'm trying to create a Global variable with can be reset and used anywhere in the script.

In the following example I trying to pick up the value from the Environment Element and store it in the Parameter EnvironmentParam and then in the ProductType template output the new value held in the EnvironmentParam parameter.

From an earlier post I read it sounded like maybe I could use the key
function to do this but I could not get it to work using that eiter.

Thanks Shane.

My sample script and xml below:

************* XSLT File *************
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:msxml="urn:schemas-microsoft-com:xslt">


<xsl:param name="EnvironmentParam" select=" 'DefaultEnvironment' "/>

	<xsl:template name="RootTemplate" match="/">
		<xsl:apply-templates select="Environment"/>
		<xsl:apply-templates/>
	</xsl:template>


<xsl:template name="ProductTypeTemplate" match="ProductType">
<ProductType>
<EnvironmentParam><xsl:value-of select="$EnvironmentParam"/></EnvironmentParam>
<SystemType><xsl:value-of select="SystemType"/></SystemType>
<SystemID><xsl:value-of select="SystemID"/></SystemID>
</ProductType>
</xsl:template>


	<xsl:template name="EnvironmentTemplate" match="Environment">
		<xsl:param name="TheEnvironmentParam" select="."/>
	</xsl:template>

</xsl:stylesheet>


************* XML File *************
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="C:\Dev\XSLTest\TestFiles\COMTestWithParam.xsl"?>
<Request>
<Environment>NewEnvironment</Environment>
<ProductTypes>
<ProductType>
<SystemType>AB</SystemType>
<SystemID>A</SystemID>
<TypeDescription>System ID1</TypeDescription>
</ProductType>
<ProductType>
<SystemType>AB</SystemType>
<SystemID>A</SystemID>
<TypeDescription>System ID2</TypeDescription>
</ProductType>
</ProductTypes>
</Request>



_________________________________________________________________ Express yourself with cool emoticons http://www.msn.co.uk/messenger


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.