When is a <group> ignored?

Hi,

This is a follow-up to a private conversation with Bruce:

I’m still unclear on the precise semantics of elements.

Is the whole group supposed to be ignored under certain circumstances,
or only child elements (which is what the comment in
csl.rnc suggests)? I assume it’s the former.

What is the precise condition under which a group is not displayed?
a) The group contains no descendants after macro
expansion?
b) The group contains no children that evaluate to
non-empty text?
c) The group contains no descendants that evaluate
to non-empty text?
d) Something else?

A group delimiter would be printed between every child, even between
or elements, right?

By the way: If a variable does not exist for an entry, is supposed to generate empty output or trigger an
error? I assume it’s the former.

Thanks for any hint.

Stephan

Hi,

This is a follow-up to a private conversation with Bruce:

I’m still unclear on the precise semantics of elements.

Is the whole group supposed to be ignored under certain circumstances,
or only child elements (which is what the comment in
csl.rnc suggests)? I assume it’s the former.

What is the precise condition under which a group is not displayed?

you remove and elements and evaluate. If no
output is generated the group is not displayed.

A group delimiter would be printed between every child, even between
or elements, right?

yes.

By the way: If a variable does not exist for an entry, is supposed to generate empty output or trigger an
error? I assume it’s the former.

empty output.

Thanks for any hint.

Sure.
Andrea

Andrea Rossato wrote:> On Mon, Aug 04, 2008 at 08:21:15PM +0200, Stephan Tolksdorf wrote:

Hi,

This is a follow-up to a private conversation with Bruce:

I’m still unclear on the precise semantics of elements.

Is the whole group supposed to be ignored under certain circumstances,
or only child elements (which is what the comment in
csl.rnc suggests)? I assume it’s the former.

What is the precise condition under which a group is not displayed?

you remove and elements and evaluate. If no
output is generated the group is not displayed.

Remove any and child or descendant? What if a
only returns non-empty output because of a prefix or suffix?

I’m hoping somebody can formalize an equivalent mapping between a group
and a sequence of non-group elements…

Thanks,
Stephan

Remove any and child or descendant? What if a
only returns non-empty output because of a prefix or suffix?

Prefix or suffix content does not get genated unless there is data
(variable) content.

I’m hoping somebody can formalize an equivalent mapping between a group
and a sequence of non-group elements…

Am in a bit of a hurry, so hope this is right …

example 1.

… maps to:

example 2.

… maps to:

example 3.

… maps to:

HTH,
Bruce

Bruce D’Arcus wrote:

Prefix or suffix content does not get genated unless there is data
(variable) content.

Are the following two statements also true?

A prefix or suffix of any element with formatting attributes is not
displayed if the element itself evaluates to empty output.

A delimiter that would otherwise be inserted before an element or
variable is not displayed if the element or variable evaluates to empty
output.

I’m hoping somebody can formalize an equivalent mapping between a group
and a sequence of non-group elements…

Am in a bit of a hurry, so hope this is right …
(…)
example 3.

… maps to:

Thanks for the examples. They don’t yet cover (nested) names, choose and
group children, but it seems consistent to treat names, choose and group
children as if wrapped by a macro definition.

To sum up the discussion, is the following slight variation of Andrea’s
description correct?

‘A group that would generate no output if all immediate and child elements were deleted is not
displayed.’

If “url” is an empty variable then the above definition implies that

generates no output (Bruce’s example 1), but

would generate the output "Url: " (Bruce’s example 2), as would

.

Is this the intended behaviour?

Thanks for the help.

Stephan

Bruce D’Arcus wrote:

Prefix or suffix content does not get genated unless there is data
(variable) content.

Are the following two statements also true?

A prefix or suffix of any element with formatting attributes is not
displayed if the element itself evaluates to empty output.

Yes.

A delimiter that would otherwise be inserted before an element or
variable is not displayed if the element or variable evaluates to empty
output.

We’ve never explicitly discussed that, but I’d tend to say yes.

I’m hoping somebody can formalize an equivalent mapping between a group
and a sequence of non-group elements…

Am in a bit of a hurry, so hope this is right …
(…)
example 3.

… maps to:

Thanks for the examples. They don’t yet cover (nested) names, choose and
group children, but it seems consistent to treat names, choose and group
children as if wrapped by a macro definition.

Correct.

To sum up the discussion, is the following slight variation of Andrea’s
description correct?

‘A group that would generate no output if all immediate and child elements were deleted is not
displayed.’

Hmm … I’ll let Andrea comment :wink:

If “url” is an empty variable then the above definition implies that

generates no output (Bruce’s example 1), but

would generate the output "Url: " (Bruce’s example 2), as would

.

Is this the intended behaviour?

Yes. Andrea; you agree?

Bruce

To sum up the discussion, is the following slight variation of Andrea’s
description correct?

‘A group that would generate no output if all immediate and child elements were deleted is not
displayed.’

Hmm … I’ll let Andrea comment :wink:

Yes, I would say this is correct, or at least this is what the Haskell
implementation does.

If “url” is an empty variable then the above definition implies that

generates no output (Bruce’s example 1), but

would generate the output "Url: " (Bruce’s example 2), as would

.

Is this the intended behaviour?

Yes. Andrea; you agree?

Yes for the first, no for the second. is producing some
output and so that group is producing some output even when the
variable “url” is not set. But the second example will not produce
anything, since:

<group class="label">
   <text value="Url: "/>
</group>

this will not produce output (this is meaningless, actually), and so
the group will not produce output.

on the contrary, this will produce some output if the locator variable
is set, otherwise no output:

<group>
  <group class="label">
<text value="Url: "/>
<text variable="locator" prefix=" "/>
  </group>
  <text variable="url"/>
  </group>

At least this is how I understood those issues after a long
discussion[1].

Andrea

[1] http://sourceforge.net/mailarchive/forum.php?thread_name=20080706173907.GA27730%40laptop.nowhere.net&forum_name=xbiblio-devel

Andrea Rossato wrote:

Yes for the first, no for the second.
is producing some
output and so that group is producing some output even when the
variable “url” is not set. But the second example will not produce
anything, since:

<group class="label">
   <text value="Url: "/>
</group>

this will not produce output (this is meaningless, actually), and so
the group will not produce output.

You are right. This was an oversight on my side.

So

</else

would generate “Url: (none)” if the variable URL was empty, right?

Thanks a lot,
Stephan

yes, right.

Andrea