Re: [xsl] question about child::node()

Subject: Re: [xsl] question about child::node()
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 18 Jun 2003 12:12:27 +0100

  what is the difference between:
  <xsl:if test="local-name(//preface/child::paramod)"/>
  and
  <xsl:if test="local-name(//preface/child::node())='paramod'">


the first one is exactly the same test  as

 <xsl:if test="//preface/paramod"/>

and is true if any preface element has a paramod child.
(the call to local-name doesn't do anything as it will return 'paramod'
if there is an element and '' otherwise but in a boolean test
non empty strings and non empty node sets are both counted teh same as
true)

the second one
is true if the first node in the document that is a child of a preface
element has local name 'paramod' and is false otherwise. It would for
example be false for
<preface>
 <paramod>
as the first child node or preface is a text node with a newline and a
space.

Both of these expressions are highly strange they use // to search the
entire document and then throw away almost all of the information and
just test one node. What are you actually trying to test?

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