It's a bug (in your code). <xsl:value-of> extracts the textual content of a node: your variable $product page will be a temporary tree containing a document node and a single text node, with the text node containing all the text (and no markup) from the requested document. The document node therefore doesn't contain an html element, so $product-page/html finds nothing.
 
When people write:
 
<xsl:variable name="x">
  <xsl:value-of select="y"/>
</xsl:variable>
 
then 99 times out of 100 they should have written:
 
<xsl:variable name="x" select="y"/>
 
which is shorter, more efficient, and in some cases like this one, actually gives you the answer you wanted.
 
Michael Kay
-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Gil Tayar
Sent: 01 October 2003 16:04
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Multiple input documents - bug or feature

I have the following:
 
        <xsl:variable name="product-page">
          <xsl:value-of select="document($product-page-filename)" />
        </xsl:variable>
 
        <xsl:variable name="title">
          <xsl:value-of select="$product-page/html/head/title" />
        </xsl:variable>
 
This seems not to work (the "title" variable remains empty").
 
While, this does work -
 
        <xsl:variable name="product-page">
          <xsl:value-of select="document($product-page-filename)" />
        </xsl:variable>
 
        <xsl:variable name="title">
          <xsl:value-of select="document($product-page-filename)/html/head/title" />
        </xsl:variable>
 
Is that a bug, or a feature? :-)
 
Gil Tayar
Chief Technology Officer
WebCollage
Business: (212) 563 2643
Mobile: (917) 509 9663