Skip to main content
QuintinSeegers
Legend
May 27, 2021
Answered

Symbols in Coversion Table Rules

  • May 27, 2021
  • 1 reply
  • 800 views

I'm having trouble understanding the use of the symbols in rules in a conversion table. My understanding is:

| = any one of the items in the sequence an occur

& = Items can occur in any order

, = Items must occur in the given order

+ = Item is mandatory and can occur more than once

* = Item is optional and occur more than once

? = Item is optional and can occur only once

( ) =  subclause of rule(s)

 

Say I have 3 elements:

Element A, which must occur at least once (first), but can appear multiple times after that

Element B, which is optional, can appear multiple times but only once per preceding Element A

Element C, which wrappes Elements A and B.

I could have any of the following combinations of elements A and B:

A

AA

AB

AABA

ABAA

AABABAA

All of which should wrap in Element C.

 

The rule I'm trying to create in my Convervsoin Table is: Wrap Element A, followed by multiple instances of Element A and/or an Element B, in any order or combination, in Element C. I've tried numerous combinations of these symbols but always only get the sequences A, AA, AB wraped in Element C.

 

Do I need to write an extremely verbose rule that says: Wrap a mandatory Element A, followed by (either one or more Element A's or an Element B), followed by (either an Element B or one or more Element A's), followed by (an Element B), followed by (one or more Element A's), in Element C in order to achieve the correct outcome?

 

 

 

 

This topic has been closed for replies.
Correct answer Lynne A. Price

Lynne,

I've sent you an email with the files attached.

Much appreciated :-).


Quintin,

   I am also surprised that FrameMaker does not match the pattern

      StepItem[SI1], ((NumList[NL2] | Notes | Screenshot | FieldList | IndentedText)* , StepItem[SI1]*)

when it encounters a single StepItem. My comments below include:

  1. An analysis of the problem.
  2. A simple fix.
  3. Suggestions for changing the model

 

1. Analysis

   To summarize the situation, your conversion table correctly recognizes numbered list items and wraps them in StepItem elements, using qualifiers to distinguish top-level lists from sublists. You would like to wrap a sequence of StepItem elements, each possibly followed by sublists or other specific elements in a NumList. Your current expression succeeds in wrapping a NumList when it contains at least two elements, but fails to wrap a single StepItem.

   To make the parts of the expression more visible, here is a paraphrase with OtherElts indicating the elements other than other StepItems that you would like to recognize in a list:

      StepItem[SI1], ((OtherElts)* , StepItem[SI1]*)

The parenthesized subexpression is a sequence of two parts: the first StepItem in the list and the elements that can follow the first StepItem. Any following elements is a sequence beginning with zero or more OtherElts and then zero or more additional StepItems. Since neither part of the subexpression is required to contain anything, the entire subexpression seems to be satisfied even if there are no matching elements following the first StepItem, but that is not the case.

 

2. Simple Fix (well, two actually)

   Note that the outer set of parentheses is not needed. The original expression seems equivalent to:

      StepItem[SI1], (OtherElts)* , StepItem[SI1]*

This version also expresses a sequence beginning with a StepItem, optionally followed by some of the listed other elements, and then optionally by more StepItems. However, the two expressions are not processed the same way. FrameMaker expects something to match the parenthesized subexpression in the original expression and so fails to wrap a single StepItem in a NumList. Removing the unneeded parentheses solves the problem and produces the desired results.

   The unneeded parentheses may make the expression somewhat more readable to a person since it groups things that may follow the first StepItem. You can keep them if you add ? at the end to clarify that no additional content is needed in the list:

      StepItem[SI1], ((OtherElts)* , StepItem[SI1]*)?

 

3. Changing the Model

   I suggest two changes to the model:

 

1. Notice that the current versions allows OtherElts after the first StepItem in the list, but not after successive StepItems. To treat all StepItems the same way, consider changing the expression to:

      (StepItem[SI1], (OtherElts)*)+

 

2. Do you view the OtherElts as serving the same purpose in a NumList as a StepItem? Or do you think of them as part of the preceding or following StepItem? My own preference is to put them in the preceding StepItem, so that a NumList is defined to be simply StepItem+ and a StepItem is defined to be either:

      (<TEXT>, (OtherElts)*)

or

      (Paragraph, (OtherElts)*)

I have seen many models for structured documents that do define sublists as children of the containing list rather than of items in the containing list. Some models allow some of the other elements you've included, particularly notes, to appear between rather than within items. And there are environments in which some of the OtherElts are treated one way and some the other.

 

--Lynne

 

 

1 reply

Inspiring
May 28, 2021

Quintin,

    Do I understand correctly that you want a sequence of one or more A's, each of which can be followed by a single B? If so, I believe the expression you want is (A, B?)+. The + means one or more occurrences of the parenthesized pattern, each of which consists of an A that is optionally followed by a B.

        --Lynne

 

QuintinSeegers
Legend
May 28, 2021

In its simplest form, yes. However, I find that as soon as I expand the rule to include other elements that can follow A, the rule falls apart, e.g. (A, B?)+, C* will only work if the sequence is ABAC or AC but not A, AABA or ACAB. I end up with AAB/AC wrap in a separate element from A/AB. As soon as any of the elements appear in a different sequence or are missing, the rule fails.

Inspiring
May 28, 2021

Please clarify the sequences you are trying to match. Where can C occur? 

(A, B?)+, C* means one or more A's, each of which is optionally followed by a B and all of the As and Bs followed by any number (including none) of C's. 

It might help if you explained what the actual elements are.

      --Lynne