Your post is a little confusing, but I will give it a shot:
This line:
Code:
<xsl:variable name="XmlFile" select="YG.xml"/>
should be:
Code:
<xsl:variable name="XmlFile" select="'YG.xml'"/>
The select statement is looking for an xpath expression or a string. Either wrap you string in single quotes
or
also,
Code:
<xsl:value-of select="document('$XmlFile')/aziende/azienda/ragione_sociale"/>
should be
Code:
<xsl:value-of select="document($XmlFile)/aziende/azienda/ragione_sociale"/>
When calling a variable, you do not use single quote, because it is not a string.