Re: [xsl] <no subject>

Subject: Re: [xsl] <no subject>
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Tue, 06 Nov 2001 12:56:24 +0000
Klaus Weitzer  wrote:

>...the problem is: if i use xsl:variable select="document(/R/L/@uri)"
>everything is ok as long as @uri is set. IE crashes if you use
>document() with an empty parameter.
I think you mean that if /R/L/@uri evaluates to an empty node set,
xsl:variable select="document(/R/L/@uri)" causes IE to crash?  That
sounds like a bug to me, I think it should simply return an empty node

>I think that setting a variable via the content = result tree fragment
>should be something like <xsl:copy-of select="document(/R/L/@uri)"/>
>but it doesn't work.
That should work, with one caveat: remember that
count(node-set($refxml)) will *always* be 1, regardless of how many
input documents you have.

Your original attempt will give you a node set containing a root node
for each document (two in the example you gave).  Because the copy-of
doesn't copy the root nodes returned by the document call, you will
get (after calling node-set($refxml)) a node set with *one* root node
whose children are all the top level nodes from the documents read.
Maybe this is tripping you up later?

Also the 'otherwise' might as well be empty: you cannot stop the root
node for the result tree being created by doing anything here with
empty node-set. Note, <xsl:value-of select="/.." /> gives you a text
node containing an empty string.  You 'copy' an empty node set by
doing nothing!

Trevor Nash
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:

Current Thread