Q:

Dynamic path in document function()

The XML file name is specific but I need to build a dynamic path.  I have tried using a variable to build the path but it didn't work:   
<xsl:variable name="path">
   ...conditional code
</xsl:variable>     <xsl:value-of select="document('myXML.xml')/worksheets/$path"/> 

2.0 solutions ok.  

A:

Evaluation of any dynamically-generated XPath expression is not supported by the XSLT 1.0 or XSLT 2.0 standards. It will be supported in XSLT 2.1.
If the dynamically-generated XPath expression is not too complex, the technique in this answer can be used successfully:
Retrieving XML node from a path specified in an attribute value of another node

