RE: variable question
> <xsl:template match="MYROOT"> > <xsl:variable name="BusinessPartnerContract"> > This is a business partner contract. > </xsl:variable> > ... > </xsl:template> As you have discovered, a variable assignment only has scope along the descendant and following-sibling axes. To make the variable available for use in another template, you have two options: 1. Set it at the top level, somewhere between the xsl:stylesheet and the first xsl:template. This makes it available to all templates, but is bad if it needs to have different values at different times. 2. Make sure it is in scope at the point where you call or apply the other templates, and pass it as a parameter. <xsl:variable name="foo" select="'some string'"/> <xsl:call-template name="pageHeader"> <xsl:with-param name="bar" select="$foo"/> </xsl:call-template> ... <xsl:template name="pageHeader"> <xsl:param name="bar"/> <xsl:value-of select="$bar"/> </xsl:template> This can be inconvenient but it does ensure that each template operates independently of the others; with the exception of parameters that must be explicitly passed and received, one template can't set a state or have a side effect that another template can be aware of. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format