Skip to main content
QuintinSeegers
Legend
May 24, 2021
Answered

Conversion Table rule with optional elements

  • May 24, 2021
  • 2 replies
  • 440 views

In our EDD, we have a Section element that consists of a mandatory Heading element. It can then be followed by any of the following optional elements, in any order and they can appear multiple times:

  • Navigation (Table element)
  • Paragraph (<TEXT> element)
  • HowToInstruction (Table element)
  • FieldList (Table element)
  • Section (Section element, creating a sub-section)

In our Conversion Table (to apply structure to our unstructured documents), I have a rule to wrap the elements. I tried using the | symbol (any one of the items can occur): E:Heading, (Navigation* | E:Paragraph* | HowToInstructions* | FieldList* | Section*), as well as the & symbol (items can occur in any order): E:Heading, (Navigation* & E:Paragraph* & HowToInstructions* & FieldList* & Section*). In both cases, the rule will only work if all the elements appear. If any of the elements are missing, the rule doesn't work.

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

    Quintin,

        To expand a bit on my previous reply, I suspect you do not want to allow paragraphs and your different tables to follow subsections (although they, of course, can occur in subsections. If so, a better general rule is:

            Heading, (Navigation | Paragraph | HowToInstructions | FieldList)*, Section*)

    which means a Heading, followed by zero or more paragraphs or tables (arranged in any order), followed by zero or more sections.

       Notice that I have dropped the E: prefix in front of the containers. E: just means element, which is the default in a conversion table. You could have included it in front of the tags for the tables as well.

       A final point is that the rule above allows for a Section to consist solely of a Heading. If you want to ensure that at least one of the other elements occurs, try:       

            Heading, ((Navigation | Paragraph | HowToInstructions | FieldList)+, Section*) | Section+)

    This one means a Heading followed either by:

    1. One or more Paragraphs or tables in any order, optionally followed by some subections
    2. One or more subsections

       Traditional publishing practice prohibited use of single subsections, viewing the purpose of subsections as a way of contrasting different parts of a section. More recently, a single subsection can be used to assign a heading to the last part of the containing section. If your organization does prohibit single subsections, you can enforce that requirement by replavcing Section* above with (Section, Section+)? and Section+ with (Section, Section+). 

       You might want to use these expressions in your EDD as well as your conversion table.

           --Lynne

     

     

    2 replies

    Lynne A. PriceCorrect answer
    Inspiring
    May 24, 2021

    Quintin,

        To expand a bit on my previous reply, I suspect you do not want to allow paragraphs and your different tables to follow subsections (although they, of course, can occur in subsections. If so, a better general rule is:

            Heading, (Navigation | Paragraph | HowToInstructions | FieldList)*, Section*)

    which means a Heading, followed by zero or more paragraphs or tables (arranged in any order), followed by zero or more sections.

       Notice that I have dropped the E: prefix in front of the containers. E: just means element, which is the default in a conversion table. You could have included it in front of the tags for the tables as well.

       A final point is that the rule above allows for a Section to consist solely of a Heading. If you want to ensure that at least one of the other elements occurs, try:       

            Heading, ((Navigation | Paragraph | HowToInstructions | FieldList)+, Section*) | Section+)

    This one means a Heading followed either by:

    1. One or more Paragraphs or tables in any order, optionally followed by some subections
    2. One or more subsections

       Traditional publishing practice prohibited use of single subsections, viewing the purpose of subsections as a way of contrasting different parts of a section. More recently, a single subsection can be used to assign a heading to the last part of the containing section. If your organization does prohibit single subsections, you can enforce that requirement by replavcing Section* above with (Section, Section+)? and Section+ with (Section, Section+). 

       You might want to use these expressions in your EDD as well as your conversion table.

           --Lynne

     

     

    QuintinSeegers
    Legend
    May 24, 2021

    @Lynne A. PriceGood to see I was at least on the right track.

    We also have 2 Heading elements: Heading and HeadingNoIndex. To expand this rule, I tried (Heading+ | HeadingNoIndex+), ((Navigation | Paragraph | HowToInstructions | FieldList)*, Section*), i.e. a Heading or HeadingNoIndex element, followed by one or more Navigation, Paragraph HowToInstructions or Field List elements, followed by one or more Section elements. It still works correct for Heading elements, but HeadingNoIndex elements aren't wrapped in a Section element. Do I need to create a separate rule for Heading and HeadingNoIndex elements?

    QuintinSeegers
    Legend
    May 24, 2021

    Nevermind. Silly me had a typo in my rule, hence it didn't work. All working now :-).

    Inspiring
    May 24, 2021

    Quinten,

       The problem is in the placement of the asterisks. Your first expression:

            E:Heading, (Navigation* | E:Paragraph* | HowToInstructions* | FieldList* | Section*)

    means a heading followed by any number of one of the other elements. It does not allow different types of the other elements. Instead of (Navigation* | Paragraph * ...)  what you want is (Navigation | Paragraph | ...)*. In other words, you want any number of repetitions of the group, each repetition being any one of the listed elements with different elements possible in each repetation.

       --Lynne