# When is a \<group\> ignored?

**URL:** <https://discourse.citationstyles.org/t/when-is-a-group-ignored/499>\
**Category:** CSL Development\
**Created:** [August 4, 2008, 6:21pm UTC](https://discourse.citationstyles.org/t/when-is-a-group-ignored/499 "2008-08-04T18:21:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephan\_Tolksdorf](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@Stephan\_Tolksdorf](https://discourse.citationstyles.org/u/Stephan_Tolksdorf)\
**Post date:** [August 4, 2008, 6:21pm UTC](https://discourse.citationstyles.org/t/when-is-a-group-ignored/499/1 "2008-08-04T18:21:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andrea\_Rossato1](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Andrea\_Rossato1](https://discourse.citationstyles.org/u/Andrea_Rossato1)\
**Post date:** [August 4, 2008, 6:48pm UTC](https://discourse.citationstyles.org/t/when-is-a-group-ignored/499/2 "2008-08-04T18:48:52Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Stephan\_Tolksdorf](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@Stephan\_Tolksdorf](https://discourse.citationstyles.org/u/Stephan_Tolksdorf)\
**Post date:** [August 4, 2008, 7:00pm UTC](https://discourse.citationstyles.org/t/when-is-a-group-ignored/499/3 "2008-08-04T19:00:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [August 4, 2008, 7:08pm UTC](https://discourse.citationstyles.org/t/when-is-a-group-ignored/499/4 "2008-08-04T19:08:21Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Stephan\_Tolksdorf](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@Stephan\_Tolksdorf](https://discourse.citationstyles.org/u/Stephan_Tolksdorf)\
**Post date:** [August 4, 2008, 8:55pm UTC](https://discourse.citationstyles.org/t/when-is-a-group-ignored/499/5 "2008-08-04T20:55:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [August 4, 2008, 9:37pm UTC](https://discourse.citationstyles.org/t/when-is-a-group-ignored/499/6 "2008-08-04T21:37:00Z")

</div>

> 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 😉

> 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

---

<div class="post-metadata">

**Author:** ![Andrea\_Rossato1](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Andrea\_Rossato1](https://discourse.citationstyles.org/u/Andrea_Rossato1)\
**Post date:** [August 5, 2008, 9:31am UTC](https://discourse.citationstyles.org/t/when-is-a-group-ignored/499/7 "2008-08-05T09:31:57Z")

</div>

> > 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 😉

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] [Thread: [xbiblio-devel] 2 questions | XBib](http://sourceforge.net/mailarchive/forum.php?thread_name=20080706173907.GA27730%40laptop.nowhere.net&forum_name=xbiblio-devel)

---

<div class="post-metadata">

**Author:** ![Stephan\_Tolksdorf](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@Stephan\_Tolksdorf](https://discourse.citationstyles.org/u/Stephan_Tolksdorf)\
**Post date:** [August 5, 2008, 9:58am UTC](https://discourse.citationstyles.org/t/when-is-a-group-ignored/499/8 "2008-08-05T09:58:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andrea\_Rossato1](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Andrea\_Rossato1](https://discourse.citationstyles.org/u/Andrea_Rossato1)\
**Post date:** [August 5, 2008, 10:30am UTC](https://discourse.citationstyles.org/t/when-is-a-group-ignored/499/9 "2008-08-05T10:30:42Z")

</div>

yes, right.

Andrea
