Re: [xsl] Cannot use result tree fragment

Subject: Re: [xsl] Cannot use result tree fragment
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 18 Jun 2003 17:36:51 +0100
This is a FAQ
If you use xsl:variable with content it generates a result tree
fragment, you can not query into that, all you can do is copy it with
copy-of to the result, or use it as a string.

Most XSLT systems have a node-set extension function to generate a node
set from a result tree fragment.

In your case though your result tree fragment would still not work as it
does not have the nodes of the documents only there character data as

<xsl:value-of
select="document(

xsl:value-of _always_ returns a string.

You can solve both these pronlems and avoid teh need for a node-set
extension function by going

<xsl:variable name="vchapmod1"
 select="document(concat(string($vchapmod/attribute::docref),'.xml'))"/>

so now vchapmod1 contains the document nodes directly.

You don't need the $vchapmod variable at all that is just the current
node so this can be written


<xsl:variable name="vchapmod1"
 select="document(concat(@docref,'.xml'))"/>

If you only use this variable in one place you don't need a variable at
all and could just have


<xsl:for-each select="document(concat(@docref,'.xml')//ht">


David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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


Current Thread