Snippet:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:msa="http://www.publictalksoftware.co.uk/msa">
<xsl:output method="html" indent="yes" version="4.01"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
<xsl:param name="CSSFile1"></xsl:param>
<xsl:variable name="DutyHistory" select="document('DutyAssignHistory.XML')"/>
<xsl:variable name="LabelsInfo" select="document('LabelsInfo.XML')"/>
<xsl:template match="/">
Does it matter if the xsl:variable lines go before or after the xsl:param line? I moved them inside Visual Studio and saw no warnings but I wondered if there was some underlying expectation of which order to have these in the XSL file.
>Solution :
The relative order in which variables and parameters are defined makes no difference. The only thing that matters is that they are in scope at the point in the stylesheet where you want to use them.
You could even do:
<xsl:variable name="b" select="2 + $a"/>
<xsl:param name="a" select="3"/>
and the result of
<xsl:value-of select="$b"/>
will be 5 in any region of the stylesheet tree within which these bindings are visible – see: https://www.w3.org/TR/1999/REC-xslt-19991116/#variables