Q: Can a variable from xsl version 1 be used into a xsl version 2? The first file where the variable is created has the following format:
<xsl:stylesheet version="1.0"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
            xmlns:date="java.util.Date"                
            xmlns:vector="java.util.Vector"
            xmlns:xalan="http://xml.apache.org/xalan"                
            extension-element-prefixes="date vector xalan">
<xsl:output method="text" indent="yes" encoding="ISO-8859-1"/>

<xsl:variable name="MyVariableTemp">
    <A>
        <xsl:element name="elementA">
            <xsl:attribute name="A1">1</xsl:attribute>
            <xsl:attribute name="A2">2</xsl:attribute>
        </xsl:element>
        <!-- more elements -->
    </A>
</xsl:variable>
<xsl:variable name="MyVariable" select="xalan:nodeset($MyVariableTemp)"/>

The second file where I want to use it looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:date="java.util.Date"                
            xmlns:vector="java.util.Vector"                
            xmlns:math="java.lang.Math"
            xmlns:int="java.lang.Integer"
            xmlns:long="java.lang.Long"
            xmlns:double="java.lang.Double"
            xmlns:saxon="http://saxon.sf.net/"
            xmlns:xalan="http://xml.apache.org/xalan"
            xmlns:exsl="http://exslt.org/common"
            xmlns:bigint="java:java.math.BigInteger"
            extension-element-prefixes="date vector math int long double saxon xalan exsl bigint">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

Is there a way to use the variable in the second file without changing the version of either of them?
I have tried using <xsl:include href="os_settings.xsl"/>.

A: It depends on which XSLT processor you want to use. If you use Xalan then of course it will recognize and support the Xalan namespace and the call to xalan:nodeset. If you use Saxon then it won't recognize the Xalan namespace and will throw an error on the call to xalan:nodeset. So it is not a question of the version you put into the version attribute, rather it is a question of which XSLT processor you want to use. If the main stylesheet uses XSLT/XPath 2.0 features then of course you won't get far with Xalan running that stylesheet, but that is a different topic.
In a similar question recently on exsl:node-set support in Saxon 9 I think it was suggested to implement the extension function as e.g.
<xsl:function name="xalan:nodeset()"/>
  <xsl:param name="seq"/>
  <xsl:sequence select="$seq"/>
</xsl:function>

That might be a workaround with Saxon, your including or better importing module should define that dummy function, then it should be possible to import and use the other module.

A: I managed to solve the problem:


*

*I included xmlns:exsl="http://exslt.org/common" in the version 1.0 file and then instead of xalan:nodeset I used exsl:node-set

*I also had to remove <xsl:output method="text" indent="yes" encoding="ISO-8859-1"/> from the first file and then I was able to use <xsl:include href="os_settings.xsl"/>
