version 1.15, 1997/05/23 07:47:57
|
version 1.16, 1997/06/10 16:07:42
|
Line 2953 followed by a colon and the counting fun
|
Line 2953 followed by a colon and the counting fun
|
The counter declaration ends with a semi-colon.</P> |
The counter declaration ends with a semi-colon.</P> |
<P> |
<P> |
The counting function indicates how the counter values will be calculated. |
The counting function indicates how the counter values will be calculated. |
Three types of counting functions are available: <TT>Rank</TT>, <TT>SET</TT>, |
Three types of counting functions are available. The first type is used to |
and <TT>RLEVEL</TT>.</P> |
count the elements of a list or aggregate: it assigns to the counter the rank |
|
of the element in the list or aggregate. More precisely, the function</P> |
<DIV class="subsubsection"> |
|
<H4><A name=sectd4241><TT>RANK</TT> counters</A></H4> |
|
<P> |
|
The first type is used to count the elements of a list or aggregate: it |
|
assigns to the counter the rank of the element in the list or aggregate. More |
|
precisely, the function</P> |
|
<PRE> |
<PRE> |
RANK OF ElemID [ CondAttr ] [ LevelAsc ] [ INIT AttrID ] |
RANK OF ElemID [ LevelAsc ] [ INIT AttrID ] |
[ 'REINIT' AttrID ] |
[ 'REINIT' AttrID ] |
</PRE> |
</PRE> |
<P> |
<P> |
Line 2981 partial expansion. To resolve this ambi
|
Line 2975 partial expansion. To resolve this ambi
|
refers to the type defined in the structure schema while the <TT>ElemID</TT> |
refers to the type defined in the structure schema while the <TT>ElemID</TT> |
preceded by a star refers to the included type.</P> |
preceded by a star refers to the included type.</P> |
<P> |
<P> |
The type name <TT>ElemID</TT> can be followed by a condition on the presence |
The type name <TT>ElemID</TT> can be followed by an integer. That number |
or absence of a logical attribute associated with the element. This is |
|
indicated by the keyword <TT>WITH</TT> or <TT>WITHOUT</TT> and an attribute |
|
name, just after the type name. It means that elements of that type are |
|
counted only if they have (do not have, respectively) that attribute, |
|
whatever its value.</P> |
|
<P> |
|
The type name <TT>ElemID</TT>, and the condition on an attribute if it is |
|
present, can be followed by an integer. That number |
|
represents the relative level, among the ancestors of the creating element, of |
represents the relative level, among the ancestors of the creating element, of |
the element whose rank is asked. If that relative level <I>n</I> is unsigned, |
the element whose rank is asked. If that relative level <I>n</I> is unsigned, |
the <I>n</I><SUP>th</SUP> element of type <TT>ElemID</TT> encountered when |
the <I>n</I><SUP>th</SUP> element of type <TT>ElemID</TT> encountered when |
travelling the logical structure from the root to the creating element is |
travelling the logical structure from the root to the creating element is |
taken into account. If there is a condition on the presence of an attribute, |
taken into account. If the relative level is negative, the logical structure |
only those elements satisfying the condition are taken into account. If the |
is travelled in the other direction, from the creating element to the |
relative level is negative, the logical structure is travelled in the other |
root.</P> |
direction, from the creating element to the root.</P> |
|
<P> |
<P> |
The function can end with the keyword <TT>INIT</TT> followed by the name of a |
The function can end with the keyword <TT>INIT</TT> followed by the name of a |
numeric attribute (and only a numeric attribute). Then, the rank of the first |
numeric attribute (and only a numeric attribute). Then, the rank of the first |
Line 3029 that view that are taken into account.
|
Line 3014 that view that are taken into account.
|
followed by the name of a numeric attribute which sets the value of the first |
followed by the name of a numeric attribute which sets the value of the first |
page's number. This attribute must be a local attribute of the document |
page's number. This attribute must be a local attribute of the document |
itself, and not of one of its components.</P> |
itself, and not of one of its components.</P> |
</DIV> |
|
|
|
<DIV class="subsubsection"> |
|
<H4><A name=sectd4242><TT>SET ADD</TT> counters</A></H4> |
|
<P> |
<P> |
The second counting function is used to count the occurrences of a certain |
The second counting function is used to count the occurrences of a certain |
element type in a specified context. The instruction</P> |
element type in a specified context. The instruction</P> |
<PRE> |
<PRE> |
SET n ON Type1 [ CondAttr ] ADD m ON Type2 [CondAttr ] [ INIT AttrID ] |
SET n ON Type1 ADD m ON Type2 [ INIT AttrID ] |
</PRE> |
</PRE> |
<P> |
<P> |
says that when the document is traversed from beginning to end (in the order |
says that when the document is traversed from beginning to end (in the order |
Line 3050 encountered.</P>
|
Line 3031 encountered.</P>
|
As with the <TT>RANK</TT> function, the type names can be preceded by a star |
As with the <TT>RANK</TT> function, the type names can be preceded by a star |
to resolve the ambiguity of included elements.</P> |
to resolve the ambiguity of included elements.</P> |
<P> |
<P> |
As with the <TT>RANK</TT> function, the type names can be followed by a |
|
condition on the presence or absence of an attribute. This condition is |
|
written in the same way as in the <TT>RANK</TT> function, with the same |
|
meaning: elements are taken into account only if they satisfy the |
|
condition.</P> |
|
<P> |
|
If the function ends with the keyword <TT>INIT</TT> followed by the name of an |
If the function ends with the keyword <TT>INIT</TT> followed by the name of an |
attribute and if the document possesses this attribute, the value of this |
attribute and if the document possesses this attribute, the value of this |
attribute is used in place of <TT>n</TT>. The attribute must be numeric. It |
attribute is used in place of <TT>n</TT>. The attribute must be numeric. It |
Line 3072 into account.</P>
|
Line 3047 into account.</P>
|
The definition of a counter can contain several <TT>SET</TT> functions and |
The definition of a counter can contain several <TT>SET</TT> functions and |
several <TT>ADD</TT> functions, each with a different value. The total number |
several <TT>ADD</TT> functions, each with a different value. The total number |
of counting functions must not be greater than 6.</P> |
of counting functions must not be greater than 6.</P> |
</DIV> |
|
|
|
<DIV class="subsubsection"> |
|
<H4><A name=sectd4243><TT>RLEVEL</TT> counters</A></H4> |
|
<P> |
<P> |
The third counting function is used to count the elements of a certain type |
The third counting function is used to count the elements of a certain type |
encountered when travelling the document's tree from the creating element to |
encountered when travelling from the creating element to the root of the |
the root of the logical tree. The creating element is counted if it is of |
logical structure. The creating element is included if it is of that type. |
that type. That function is written</P> |
That function is written</P> |
<PRE> |
<PRE> |
RLEVEL OF Type [ CondAttr ] |
RLEVEL OF Type |
</PRE> |
</PRE> |
<P> |
<P> |
where <TT>Type</TT> represents the type of the elements to be counted.</P> |
where <TT>Type</TT> represents the type of the elements to be counted.</P> |
<P> |
<P> |
As with the <TT>RANK</TT> function, the type name can be followed by a |
|
condition on the presence or absence of an attribute. This condition is |
|
written in the same way as in the <TT>RANK</TT> function, with the same |
|
meaning: elements are taken into account only if they satisfy the |
|
condition.</P> |
|
</DIV> |
|
|
|
<P> |
|
The formal definition of counter declarations is:</P> |
The formal definition of counter declarations is:</P> |
<PRE> |
<PRE> |
'COUNTERS' CounterSeq |
'COUNTERS' CounterSeq |
Line 3102 The formal definition of counter declara
|
Line 3065 The formal definition of counter declara
|
Counter = CounterID ':' CounterFunc ';' . |
Counter = CounterID ':' CounterFunc ';' . |
CounterID = NAME . |
CounterID = NAME . |
CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] |
CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ] |
[ 'INIT' AttrID ] [ 'REINIT' AttrID ] / |
[ 'INIT' AttrID ] [ 'REINIT' AttrID ] / |
SetFunction < SetFunction > |
SetFunction < SetFunction > |
AddFunction < AddFunction > |
AddFunction < AddFunction > |
[ 'INIT' AttrID ] / |
[ 'INIT' AttrID ] / |
'RLEVEL' 'OF' ElemID [ CondAttr ] . |
'RLEVEL' 'OF' ElemID . |
SLevelAsc = [ '-' ] LevelAsc . |
SLevelAsc = [ '-' ] LevelAsc . |
LevelAsc = NUMBER . |
LevelAsc = NUMBER . |
SetFunction = 'SET' CounterValue 'ON' TypeOrPage . |
SetFunction = 'SET' CounterValue 'ON' TypeOrPage . |
AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . |
AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . |
TypeOrPage = 'Page' [ '(' ViewID ')' ] / |
TypeOrPage = 'Page' [ '(' ViewID ')' ] / |
[ '*' ] ElemID [ CondAttr ] . |
[ '*' ] ElemID . |
CondAttr = 'WITH' AttrID / 'WITHOUT' AttrID . |
|
CounterValue = NUMBER . |
CounterValue = NUMBER . |
</PRE> |
</PRE> |
<BLOCKQUOTE class="example"> |
<BLOCKQUOTE class="example"> |
Line 8435 CounterFunc = 'RANK' 'OF' TypeOrPage
|
Line 8397 CounterFunc = 'RANK' 'OF' TypeOrPage
|
SetFunction < SetFunction > |
SetFunction < SetFunction > |
AddFunction < AddFunction > |
AddFunction < AddFunction > |
[ 'INIT' AttrID ] / |
[ 'INIT' AttrID ] / |
'RLEVEL' 'OF' ElemID [ CondAttr ] . |
'RLEVEL' 'OF' ElemID . |
SLevelAsc = [ '-' ] LevelAsc . |
SLevelAsc = [ '-' ] LevelAsc . |
LevelAsc = NUMBER . |
LevelAsc = NUMBER . |
SetFunction = 'SET' CounterValue 'ON' TypeOrPage . |
SetFunction = 'SET' CounterValue 'ON' TypeOrPage . |
AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . |
AddFunction = 'ADD' CounterValue 'ON' TypeOrPage . |
TypeOrPage = 'Page' [ '(' ViewID ')' ] / |
TypeOrPage = 'Page' [ '(' ViewID ')' ] / |
[ '*' ] ElemID [ CondAttr ] . |
[ '*' ] ElemID . |
CondAttr = 'WITH' AttrID / 'WITHOUT' AttrID . |
|
CounterValue = NUMBER . |
CounterValue = NUMBER . |
|
|
ConstSeq = Const < Const > . |
ConstSeq = Const < Const > . |