David Hunter <[email protected]> wrote:

> <define container="tag">
>   <if variable="_.contents">"&_.contents;"</if>
> </define>
>
> <tag/> -> 5.0.403 returns nothing . 5.0.449 returns "".
> <tag></tag> -> 5.0.403 returns nothing. 5.0.449 returns "".
> <tag> </tag> -> 5.0.403 returns " ".  5.0.449 returns " ".
>
> can someone confirm if this is an expected change or a bug that
> required fixing.

That specific problem is unexpected, but it is an effect of that the
handling of empty containers has been cleaned up (rxml tags no longer
has to cope with RXML.nil or "" interchangeably - they always get "").

Disregarding the compatibility aspect, I think the 5.0.449 behavior is
the correct one - the content is really "" in <tag></tag>, and <tag/> is
simply an abbreviation of that form, according to xml.

It's worth noting that the old behavior was not reliable - both 4.5 and
5.0.403 behaves like 5.0.449 if the rxml is compiled. The behavior
you're seeing only occurred in uncompiled code. That means that trying
to keep bug compatibility is messy.

What ideally should have been the case here is that all 5.0 releases
behaved like the current one. Unfortunately the changed RXML.nil
handling wasn't quite correct in the first 5.0 releases.

Perhaps there also ought to have been kludges to keep bug compatibility
in compat level 4.5, but since the buggy (i.e. old) behavior isn't
consistent I'm not sure that would have been implemented in any case.

So the bottom line is, you should have encountered that problem already
in the first 5.0 release and not now. I apologize for that, but I don't
think there's much that can be done about it now that wouldn't just make
matters worse.

Is it a serious problem for you? You can get the behavior you want
simply by using <if sizeof="_.contents &gt; 0"> instead.

Reply via email to