RE: [xsl] storing the result of a transformation in a param and evaluating the content

Subject: RE: [xsl] storing the result of a transformation in a param and evaluating the content
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 23 Nov 2004 09:30:31 -0000
> String-length only works if $content is a text node, on a result tree
> fragment, it returns false every time.
> 
> I need something that evaluates to true when a result tree fragment is
> present in the variable.
> 

The variable will always contain a result tree fragment: you are trying to
test, I think, whether the fragment (which is a document node) has any child
nodes. Since there are only two things you can do with an RTF in XSLT 1.0,
convert it to a string or copy it to another tree, there is no way of
distinguishing an RTF having a single empty element child from one that has
no children. (Both have a string value of "" - it's not true that
string-length works only on text nodes, but it is true that it gives you
zero if there are no text nodes, regardless of how many element nodes there
are.)

So: you can't do it without the xx:node-set extension.

Michael Kay
http://www.saxonica.com/

Current Thread