Skip to main content
Inspiring
May 28, 2010
Question

Context Rules

  • May 28, 2010
  • 3 replies
  • 894 views

I need to be able to describe a context to identify the first sibling PARA tag in a sequence.  I think the {first} qualifier means the first sibling - not the first sibling of the same element type.  I have used the firstpargraph rule to implement numbering for the first paragraph in a prcitem and it works for all cases except this stupid REVST case.  Note that the REVST/REVEND need to be placed in this location so that the whole paragraph can get a revision bar.  I use the "between" qualifier in a PARA rule to turn the rev bars on.  If the REVST/REVEND were inside the PARA I don't see a means to turn the rev bars on.

In the following example the first para numbers correctly.  The second one does not get a number.  This is probably because the <revst/> is considered the first paragraph so the first para rule does not fire.

<prclist1><prcitem1>

<prcitem>

<para>This is the first (and only) para in a prcitem and it is numbered correctly based on the firstparagraph rule.</para>

</prcitem>

</prcitem1>


<prcitem1>

<prcitem>

<revst/><para>This is the first paragraph in the prcitem so it should be numbered but it is not because the REVST seems to be treated as the first paragraph in the rule.  I need to number the first sibling PARA tag.

</para>
<revend/>

<para>This is a second paragraph in a prcitem - and this one should never be numbered.

</para>

</prcitem>

</prcitem1>

</prclist1>

Is there any syntax to describe the first sibling of a specific type?

Perhaps something like para{first}<prcitem<prclist1

That does not work because I think it thinks I am asking for para whose parent is the first sibling.

Thanks - Jim

This topic has been closed for replies.

3 replies

Inspiring
June 2, 2010

Yes - this is an ATA structure.  I was using the FirstParagraph rule, but when the revst occurs between the prcitem and the para tags, the FirstParagraph rule does not fire because the para is not the first.  The revst is actually only one example of the problem.  If a warning or caution appears at the beginning of a prcitem, the behavior is the same.  You don't want any first tag generating the number (e.g. warning), you want the number on the actual first paragraph following.

I managed to resolve this issue by using the XSL transform on the way in to determine the actual first paragraph (when count(preceding-sibling::para)=0) and set a new attribute that indicates the para is the first.  The edd then uses this attribute to tell which para tags to number.  I strip the attribute out in the xsl export process.

Thanks - Jim

Ian Proudfoot
Legend
June 2, 2010

Jim,

This looks like an ATA 2200 structure which means that the revst and revend are inline elements that only have an effect on the change bars. So, the answer is to number the first child in any context which can be done by using a FirstParagraph rule rather than a TextFormat rule. Using this method means that you don't need to worry about which element is first, the autonumbering will work in almost all cases.

I say almost all as there may be a problem if the first child element is an anchored object.

Ian

Inspiring
May 28, 2010

Jim,

A few thoughts...

You are correct. The {first} qualifier refers to the first ELEMENT inside the containing element, NOT the first element of a particular kind.

Maybe this will work...

Assuming that the Para element is used in several contexts, create a context rule for Para that sets its autonumbering to increase by one. Be sure to give it a series number, something like "S:<n+>"; add any tabs, periods, or whatever characters you need.

In the prcitem element, create an all contexts rule that zeroes the S counter, that is, its autonumering is "S:<=0>". The fact that there is no character between the < and the = means that the counter is NOT displayed. Then the first Para inside the prcitem will always start at 1, no matter how many elements precede it.

The caveat is that you may have to add other special context rules to get it to work in all cases. I am guessing because I do not know whether Para or pcritem are used in other ways in your EDD. I have had to do that in my EDD. Note that the use of the series letter (S, in this case) is virtually required because it helps FrameMaker keep any other numbering sequences separate from this one, for example, if you had a numbered list following one of the Para elements.

Hope this helps,

Van

Inspiring
February 16, 2023

Thanks for this suggestion. This approach is great, although this solution requires a slight modification for FM2020. The autonumbering needs to have a space before the "=" sign in order to work: "S:< =0>"

(I have no idea if earlier FM versions needed the space or not)