Highlighted

Is it possible to use contextual rules on a general rule?

Community Beginner ,
May 05, 2019

Copy link to clipboard

Copied

I'd like to simplify the structure a bit, and have several elements that are valid. However, I'd like to limit the elements in the general rule based on context. Is this possible?

Example, if Heading1 has a context of Pageblock400, then have the General Rule include Table400, Figure400?

Adobe Community Professional
Correct answer by Lynne_A__Price | Adobe Community Professional

Shane,

   EDDs are based on DTDs, and DTDs do not provide context-sensitive declarations. Thus, the answer to your question is "no".

   However, there are three other techniques you may be able to use to address this requirement:

1. Change the formatting based on context and use a prefix or autonumber that indicates an error. For example if Table400 and Figure400 are used for tables and figures and if they always have captions, you can provide two format rules for their captions. The first one would be an all-contexts rule that sets a prefix such as "*** Use Table400 only within Pageblock400 *** (and possibly change the font to red and bold). The second one would be a context rule that applies only within a Pageblock400 and sets the prefix to the empty string if no prefix is needed in that context and otherwise to the desired prefix.

2. While EDDs are based on DTDs, they are based on SGML DTDs which permit constructs not permitted in DTDs. In particular, a general rule can be followed by one or more Exclusion elements which define elements not permitted in the element being defined or any of its descendants. Therefore, your general rule can permit Table400 and Figure400, and you can exclude these elements in contexts where you don't want them. The catch is that exclusions are inherited and once enabled there's no way to turn them off. Thus, if you don't want to allow Table400 and Figure400 in specific subelements of Pageblock400, you are out of luck.

If exclusions can solve your problem, you can still save and open XML documents using the original XML DTD.

SGML also allows inclusions, permitted in an EDD using the Inclusion element. Inclusions are also inherited. Exclusions overrides inclusions. One problem with inclusions is that they are allowed anywhere in the content of applicable element. For example, if you include Table400 in a section that starts with a Title, then Table400 would be permitted prior to the Title.

3. If the requirements justify the development effort, a plugin can dynamically change general rules based on context.

Good luck,

--Lynne

TOPICS
Structured

Views

122

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Is it possible to use contextual rules on a general rule?

Community Beginner ,
May 05, 2019

Copy link to clipboard

Copied

I'd like to simplify the structure a bit, and have several elements that are valid. However, I'd like to limit the elements in the general rule based on context. Is this possible?

Example, if Heading1 has a context of Pageblock400, then have the General Rule include Table400, Figure400?

Adobe Community Professional
Correct answer by Lynne_A__Price | Adobe Community Professional

Shane,

   EDDs are based on DTDs, and DTDs do not provide context-sensitive declarations. Thus, the answer to your question is "no".

   However, there are three other techniques you may be able to use to address this requirement:

1. Change the formatting based on context and use a prefix or autonumber that indicates an error. For example if Table400 and Figure400 are used for tables and figures and if they always have captions, you can provide two format rules for their captions. The first one would be an all-contexts rule that sets a prefix such as "*** Use Table400 only within Pageblock400 *** (and possibly change the font to red and bold). The second one would be a context rule that applies only within a Pageblock400 and sets the prefix to the empty string if no prefix is needed in that context and otherwise to the desired prefix.

2. While EDDs are based on DTDs, they are based on SGML DTDs which permit constructs not permitted in DTDs. In particular, a general rule can be followed by one or more Exclusion elements which define elements not permitted in the element being defined or any of its descendants. Therefore, your general rule can permit Table400 and Figure400, and you can exclude these elements in contexts where you don't want them. The catch is that exclusions are inherited and once enabled there's no way to turn them off. Thus, if you don't want to allow Table400 and Figure400 in specific subelements of Pageblock400, you are out of luck.

If exclusions can solve your problem, you can still save and open XML documents using the original XML DTD.

SGML also allows inclusions, permitted in an EDD using the Inclusion element. Inclusions are also inherited. Exclusions overrides inclusions. One problem with inclusions is that they are allowed anywhere in the content of applicable element. For example, if you include Table400 in a section that starts with a Title, then Table400 would be permitted prior to the Title.

3. If the requirements justify the development effort, a plugin can dynamically change general rules based on context.

Good luck,

--Lynne

TOPICS
Structured

Views

123

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 05, 2019 0
Adobe Community Professional ,
May 05, 2019

Copy link to clipboard

Copied

Shane,

   EDDs are based on DTDs, and DTDs do not provide context-sensitive declarations. Thus, the answer to your question is "no".

   However, there are three other techniques you may be able to use to address this requirement:

1. Change the formatting based on context and use a prefix or autonumber that indicates an error. For example if Table400 and Figure400 are used for tables and figures and if they always have captions, you can provide two format rules for their captions. The first one would be an all-contexts rule that sets a prefix such as "*** Use Table400 only within Pageblock400 *** (and possibly change the font to red and bold). The second one would be a context rule that applies only within a Pageblock400 and sets the prefix to the empty string if no prefix is needed in that context and otherwise to the desired prefix.

2. While EDDs are based on DTDs, they are based on SGML DTDs which permit constructs not permitted in DTDs. In particular, a general rule can be followed by one or more Exclusion elements which define elements not permitted in the element being defined or any of its descendants. Therefore, your general rule can permit Table400 and Figure400, and you can exclude these elements in contexts where you don't want them. The catch is that exclusions are inherited and once enabled there's no way to turn them off. Thus, if you don't want to allow Table400 and Figure400 in specific subelements of Pageblock400, you are out of luck.

If exclusions can solve your problem, you can still save and open XML documents using the original XML DTD.

SGML also allows inclusions, permitted in an EDD using the Inclusion element. Inclusions are also inherited. Exclusions overrides inclusions. One problem with inclusions is that they are allowed anywhere in the content of applicable element. For example, if you include Table400 in a section that starts with a Title, then Table400 would be permitted prior to the Title.

3. If the requirements justify the development effort, a plugin can dynamically change general rules based on context.

Good luck,

--Lynne

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 05, 2019 3