Skip to main content
QuintinSeegers
Legend
May 17, 2021
Answered

Element availability based on context

  • May 17, 2021
  • 1 reply
  • 578 views

We have the following elements in our EDD:

  • Section, which is the 'container' for the document text, etc.
  • Activity, which is the 'container' for practical exercises
  • List for Lists
  • ListItem for the items within the List element
  • Comment, which (using the Frame Below Pgf format) adds a line for handwritten text

Both the Section and Activity containers are ValidHighestLevel elements. The Activity element cannot be a child of the Section element.

The List element can be used in both the Section and Activity elements. Formatting is the same regardless, so the same element is used.

The Comment element is a child element of the ListItem element. However, the Comment element can only be used if the parent List element (ListItem < List) is a child of the Activity element (ListItem < List < Activity). If the List element (ListItem < List) is a child of the Section element (Listitem < List < Section), the Comment element cannot be used.

 

To illustrate:

Scenario 1

Section

List

LisItem

Comment (Invalid child element)

 

Scenario 2:

Activity

List

ListItem

Comment (Valid child element)

 

I know I can create a 'error trap' context rule that is something like (paragraphsing) If contect is *< Section, use an Autonumber format to show 'Error - invalid context'. Is it possible to, instead, have the Comment element only valid based on the Context in which is used (i.e. * < Activity = Valid, * < Section = Invalid)

    This topic has been closed for replies.
    Correct answer 4everJang

    Hello Quintin,

    In FM you can do this by Exclusions. This removes an element from any descendant. Inclusions do the reverse (but the inclusion elements will become available at any position). Do note that this will not work with XML standards, as exclusions (or inclusions) are not representable in DTDs, so you cannot move this mechanism over to an XML standard.

    In your example, you need to add Exclusions: Comment to your Section element. Attached is a screenshot of my test EDD.

    Kind regards

    4everJang 

    1 reply

    4everJang
    4everJangCorrect answer
    Legend
    May 17, 2021

    Hello Quintin,

    In FM you can do this by Exclusions. This removes an element from any descendant. Inclusions do the reverse (but the inclusion elements will become available at any position). Do note that this will not work with XML standards, as exclusions (or inclusions) are not representable in DTDs, so you cannot move this mechanism over to an XML standard.

    In your example, you need to add Exclusions: Comment to your Section element. Attached is a screenshot of my test EDD.

    Kind regards

    4everJang 

    Inspiring
    May 17, 2021

    To add to @4everJang 's comment, excusions have precedence over inclusions: an element is not permitted if any ancestor excludes it, even if it is included by a nearer ancestor or explicitly allowed in the applicable general rule.

          --Lynne

     

      

    QuintinSeegers
    Legend
    May 17, 2021

    Thanks @4everJang  and @Lynne A. Price for your input. I don't know at this stage whether or not we'll be using XML in the future, so I don't want to set something up now that will cause issues down the track.

    I spoke to the team about this particular element and it turns out we do use it in a couple of our manuals where, under structured FM, it would be a child element (Child < * ) of Section, so no need to worry about In/Exclusion rules for now.