When you do
the value of the variable is the root node of a result tree fragment. So
count($x) will always be 1. The nodes you are interested in a children
of this root node; you should be using count($x/*).
XSLT 2.0, apart from providing better ways of eliminating duplicates,
also allows templates to return arbitrary values, including references
to existing nodes rather than copies of the nodes. So yes, there's a lot
of change in this area - though the code you have written will still
produce the same effect.
> -----Original Message-----
> From: saxon-help-admin@...
> [mailto:saxon-help-admin@...] On Behalf Of
> Randall J. Parr
> Sent: 05 November 2003 18:39
> To: saxon-help@...
> Subject: [saxon] why see 2 nodes when local but 1 node when call used?
> I think I'm missing something basic here but ...
> I tried to migrate a complicated search for distinct child element
> values (eg CONDITION values) from the template where it was
> used to a named template (as I now needed to perform the same
> search in
> several templates). However, I have not been able to figure
> out why the
> variable holding the search results is seen as 2 nodes when
> the search
> is performed local to the original template (and inside the named
> template) but seen as 1 node when populated via a call to the named
> I have attached a much simplified example stylesheet and data.
> Any help or guideance would be greatly appreciated.
> Temporal Arts
> P.S. Would this behaviour be different with XSLT 2 / Saxon 7?