Class XsltInstance
prepareXsltMode().-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classCollect all elements which can appear in an xslt template spontaneously on the top level of a template content, because they are reachable elements of the target text format. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTag which appears in the d2d xslt module definition as placeholder for target format elements.static final StringName of the generic d2d xslt module definition.static final StringThe tag used for the top-level element of an xslt program.static final StringName of an element definition in the d2d xslt module which or-s all xslt elements which can appear anywhere in a result elements contents. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidEnsures that no errors (= no LL-1-violation-errors) have happend when resolving the combined definitions of xslt and target.protected voidEmits a hint message iff tracelevel >0.static Altmakealt(Collection<Reference> subs) Wraps the argument in an "alt" expression.protected ModuleThe insertion of the target language classes into the content-containing xslt elements is done by once modifying the (copy of the) xslt definition module.protected ModuleFor text mode the xslt module can be used directly, no rewriting is necessary but eliminating "xslt:RESULT_ELEMENTS"protected voidEmits a warning message iff tracelevel >0.
-
Field Details
-
xslt_modulename
Name of the generic d2d xslt module definition.- See Also:
-
xslt_generic_tag_for_backend_elements
Tag which appears in the d2d xslt module definition as placeholder for target format elements.- See Also:
-
xslt_tag_toplevel
The tag used for the top-level element of an xslt program. The standard allows two variants, we support only one of these.- See Also:
-
xslt_tag_ubiquituous
Name of an element definition in the d2d xslt module which or-s all xslt elements which can appear anywhere in a result elements contents.- See Also:
-
-
Method Details
-
makealt
Wraps the argument in an "alt" expression. -
hint
Emits a hint message iff tracelevel >0. -
warning
Emits a warning message iff tracelevel >0. -
prepareXsltMode
The insertion of the target language classes into the content-containing xslt elements is done by once modifying the (copy of the) xslt definition module.Each reference to
xslt_generic_tag_for_backend_elements== "RESULT_ELEMENTS" is hard rewritten to "(#chars|A|B|C)*", with "A", "B", etc. being all reachable target model element tags. (The XSLT specification implies that only Element tags, not Attribute tags, can appear in this "free floating" way.)All xslt-tags which appear in the xslt syntax (d2d-form!) as an alterative to
RESULT_ELEMENTSthus compete/conflict with these target tags. The only place is the ruletags TEMPLATE = (#chars | @INSTRUCTIONS | @RESULT_ELEMENTS)*
Thus all xslt tags in@CHAR_PRODUCING | @STRUCTURE_PRODUCING | @INTERSPERED_NOTHING_PRODUCINGcan conflict.
These are:apply | call | apply-imports | foreach | valueof | copy-of | number | choose | if | text | copy | pi | comment | element | attribute | var | message | fallback.The other direction of inclusion, i.e. the callability of ubiquituous content-producing xslt elements out of target element's content is done dynamically, by special look-up code. See the local "boolean inxslt" in the code of
Text2Udom.process_open_tag(String, boolean). These tags are collected in the disjunction expression "INSTRUCTIONS", and thus are (accidentally) the same as in the other direction.Only those tags will be replaced by prefixed versions on case of conflicts with target tags.
The remaining few other xslt-tags (
stylesheet, result_elements, version, extension, import, include, output, key, decimal-format, namspace, priority, match, noescap, value, count, from, format, arg, sort, test, when, other, attribute-set, param, xp) will not be replaced. -
prepareXsltMode_text
For text mode the xslt module can be used directly, no rewriting is necessary but eliminating "xslt:RESULT_ELEMENTS" -
errorcheck_xsltprepare
Ensures that no errors (= no LL-1-violation-errors) have happend when resolving the combined definitions of xslt and target. These cannot happen because the xslt tags which conflict have been replaced by non-conflicting prefixed versions.
-