[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Cannot use result tree fragment


Subject: RE: [xsl] Cannot use result tree fragment
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 18 Jun 2003 19:08:06 +0100

When people write

<xsl:variable name="x">
  <xsl:value-of select="ABCD"/>
</xsl:variable>

they nearly always should be writing

<xsl:variable name="x" select="ABCD"/>

Sometimes the only effect of doing it the first way is that it runs
slower. Sometimes the effect is that it doesn't work at all.

You have copied the string value of the document into a text node. The
elements have disappeared, so even if XSLT 1.0 didn't have restrictions
on using result tree fragments, your path expression would find nothing.

Michael Kay



> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of abbouh
> Sent: 18 June 2003 17:29
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Cannot use result tree fragment
> 
> 
> i want to get all "ht"  nodes from different  external documents,so i
> use in my xsl file:
> 
> <xsl:for-each select="//doccontent/chapmod">
> <xsl:variable name="vchapmod" select="current()"/>
> <xsl:variable name="vchapmod1">
> <xsl:value-of
> select="document(concat(string($vchapmod/attribute::docref),'.
> xml'))"/>
> </xsl:variable>
> <xsl:for-each select="$vchapmod1//ht">
> 
> but i get this error :
> Error in Xpath expression,Cannot use result tree fragment
> the error is for <xsl:for-each select="$vchapmod1//ht">
> 
> why , and any other suggestion
> Thanks
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords