Here's one I've been working on for the past two days and I'm stumped.  These are global variables defined in a template called search.xsl.  The interface has a search field where I've typed "import".  The result is a collection of nodes containing the search criteria used to color highlight the search hits.
 
 <xsl:variable name="hitpath">
    <xsl:text>//*[</xsl:text>
    <xsl:call-template name="build-search-predicate"/>
    <xsl:text>]</xsl:text>
</xsl:variable>
<xsl:variable name="search-nodes" select="saxon:evaluate($hitpath)"/>
 
where build-search-predicate extracts the search criteria from the field and returns:
 
"contains(translate(.,$uppercase,$lowercase),'import')"
 
yet my attempt to utilize this path results in the error:
 
"Static error in XPath expression supplied to saxon:evaluate: Undeclared variable in a standalone expression"
 
Is this a case where SAXON has decided to ignore the hitpath variable because it's not used within a template?