xsl-list
[Top] [All Lists]

[xsl] Re: [XSL] Implicit Predicate Casting

2007-10-15 13:56:33
>> Ken wrote
>>
>> not(not(a=b) and not(a!=b)) meaning both sequence
>> a and b are not empty
>
> Are you referring to a comparison returning false if either
> operand is the empty sequence ?

Yes. But it's a "double" trick and also an example you could
give your students of things they shouldn't write because :
it can be N*N long to compute, and it is not maintanable!

When either sequence a or b (or both) are empty, you have
both: (a=b) is false and (a!=b) is false. The second "trick"
is: this situation of both (a=b) and (a!=b) being false
happens only if at least one of the sequences is empty
(I let to you to demonstrate that !).
So the above expression is true if and only if, *both*
a and b are *not* empty.


Michael wrote

I'm afraid people who write ['2'] just need to learn not to,

I agree! ['2'] would be a nasty typo, as you can have nasty
things when you forget $ in front of a variable name you
are using!


Michael wrote

as indeed do people who write
<xsl:variable name="x">2</xsl:variable>

Indeed it's bad when you meant select="2" and do that instead...
of course, unless you plan to do count($x/text()) later (quite
useless!) which would give a compile error with select="2" as
you don't have a nodeset.
Maybe this bad habit came with things like <xsl:attribute>
that didn't allow a select in 1.0. Although an attribute being a
string you would not need to construct a sequence;
the "sequence constructor" always work, so people that don't
precisely remember the syntax and don't care for performance
or memory footprint might prefer this construct.


Ken wrote

(Note I license my training material to other teachers
around the world ....

I'm a very bad teacher myself, but if I manage to help spreading
the use of XSL in my company up to the point where training
employees would be necessary, I hope they would consider
using existing materials such as yours... although we would
have to translate it to french!


Many thanks again to all of you.




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>