Subject: Re: Failing string() test fail
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 26 Jun 2009 09:10:17 +0100
|
> Correct, one Yes. That is what I would expect. So wondering why I am
> having a problem with my XML source.
whatever the problem is, it is in a part of your source, or part of your
stylesheet that you haven't shown us, so it's hard to offer much help.
Perhaps a DTD is defaulting the attribute for example.
You didn't say whether you are using xslt 1 or 2.
in xslt 1
<xsl:if test="string(C/@test)">
is true if there is a test attribute with non empty value and false if
there is not.
in xslt 2
<xsl:if test="string(C/@test)">
is false if there is no test attribute or if the single test attribute
has value "", it is true if theer is a single test attribute, and that
has non empty value, and it is an error if there are more than 1 test
attributes.
Unless you intent test="" to test as false, it's more common to just
have
<xsl:if test="C/@test">
which in xslt 1 or 2 is true if there is a test attribute and false if
there is not.
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
|