1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!--Arbortext, Inc., 1988-2011, v.4002-->
|
---|
3 | <!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
|
---|
4 | "reference.dtd">
|
---|
5 | <reference id="flagging-migration" rev="1.7" xml:lang="en-us">
|
---|
6 | <title>XHTML migration for flagging updates in DITA-OT 1.7</title>
|
---|
7 | <shortdesc>This topic is primarily of interest to developers with
|
---|
8 | XHTML transform overrides written prior to DITA-OT 1.7. Due to significant
|
---|
9 | changes in the flagging process with the 1.7 release, some changes
|
---|
10 | may be needed to make overrides work properly with DITAVAL based flagging.
|
---|
11 | The new design is significantly simpler than the old design; in many
|
---|
12 | cases, migration will consist of deleting old code that is no longer
|
---|
13 | needed.</shortdesc>
|
---|
14 | <refbody>
|
---|
15 | <section><title>Which XHTML overrides need to migrate?</title><p>If
|
---|
16 | your override does not contain any code related to DITAVAL flagging,
|
---|
17 | then there is nothing to migrate.</p><p>If your builds do not make
|
---|
18 | use of DITAVAL based flagging, but calls the deprecated flagging templates,
|
---|
19 | then you should override but there is little urgency. You will not
|
---|
20 | see any difference in the output, but those templates will be removed
|
---|
21 | in a future release.</p><p>If you do make use of DITAVAL based flagging,
|
---|
22 | try using your override with 1.7. Check the elements you override:<ol>
|
---|
23 | <li>In some cases flags may be doubled. This will be the case if you
|
---|
24 | call routines such as <codeph>"start-flagit"</codeph>.</li>
|
---|
25 | <li>In some cases flags may be removed. This will be the case if you
|
---|
26 | call shortcut routines such as <codeph>"revtext"</codeph> or <codeph>"revblock"</codeph>.</li>
|
---|
27 | <li>In other cases, flags may still appear properly, in which case
|
---|
28 | migration is less urgent</li>
|
---|
29 | </ol></p><p>For any migration that needs migration, please see the
|
---|
30 | instructions that follow.</p></section>
|
---|
31 | <section><title>Deprecated templates in DITA-OT 1.7</title><p>All
|
---|
32 | of the old DITAVAL based templates are deprecated in DITA-OT 1.7.
|
---|
33 | If your overrides include any of the following templates, they should
|
---|
34 | be migrated for the new release; in many cases the templates below
|
---|
35 | will not have any effect on your output, but all instances should
|
---|
36 | be migrated.</p><ul>
|
---|
37 | <li>The <codeph>"gen-style"</codeph> template used to add CSS styling</li>
|
---|
38 | <li>The <codeph>"start-flagit"</codeph> and <codeph>"end-flagit"</codeph> templates
|
---|
39 | used to generate image flags based on property attributes like @audience</li>
|
---|
40 | <li>The <codeph>"start-revflag"</codeph> and <codeph>"end-revflag"</codeph> templates,
|
---|
41 | used to generate images for active revisions</li>
|
---|
42 | <li>Shortcut templates that group these templates into a single call,
|
---|
43 | such as:<ul>
|
---|
44 | <li><codeph>"start-flags-and-rev"</codeph> and <codeph>"end-flags-and-rev"</codeph>,
|
---|
45 | used to combine flags and revisions into one call</li>
|
---|
46 | <li><codeph>"revblock"</codeph> and <codeph>"revtext"</codeph>, both
|
---|
47 | used to output start revisions, element content, and end revisions</li>
|
---|
48 | <li>The modes <codeph>"outputContentsWithFlags"</codeph> and <codeph>"outputContentsWithFlagsAndStyle"</codeph>,
|
---|
49 | both used to combine processing for property/revision flags with content
|
---|
50 | processing</li>
|
---|
51 | </ul></li>
|
---|
52 | <li>All other templates that make use of the <codeph>$flagrules</codeph> variable,
|
---|
53 | which is no longer used in any of the DITA-OT 1.7 code</li>
|
---|
54 | <li>All templates within <filepath>flag.xsl</filepath> that were called
|
---|
55 | from the templates listed above</li>
|
---|
56 | <li>Element processing handled with mode="elementname-fmt", such as <codeph>mode="ul-fmt"</codeph> for
|
---|
57 | processing unordered lists and <codeph>mode="section-fmt"</codeph> for
|
---|
58 | sections.</li>
|
---|
59 | </ul></section>
|
---|
60 | <section><title>What replaces the templates?</title><p>The new flagging
|
---|
61 | design described in the preprocess design section now adds literal
|
---|
62 | copies of relevant DITAVAL elements, along with CSS based flagging
|
---|
63 | information, into the relevant section of the topic. This allows most
|
---|
64 | flags to be processed in document order; in addition, there is never
|
---|
65 | a need to read the DITAVAL, interpret CSS, or evaluate flagging logic.
|
---|
66 | The <filepath>htmlflag.xsl</filepath> file contains a few rules to
|
---|
67 | match and process the start/end flags; in most cases, all code to
|
---|
68 | explicitly process flags can be deleted.</p><p>For example, the common
|
---|
69 | logic for most element rules before DITA-OT 1.7 could be boiled down
|
---|
70 | to the following:<lines>Match element
|
---|
71 | Create <codeph>"flagrules"</codeph> variable by reading DITAVAL for active flags
|
---|
72 | Output start tag such as <codeph><div></codeph> or <codeph><span></codeph>
|
---|
73 | Call <codeph>"commonattributes"</codeph> and ID processing
|
---|
74 | Call <codeph>"gen-style"</codeph> with <codeph>$flagrules</codeph>, to create DITAVAL based CSS
|
---|
75 | Call <codeph>"start-flagit"</codeph> with <codeph>$flagrules</codeph>, to create start flag images
|
---|
76 | Call <codeph>"start-revflag"</codeph> with <codeph>$flagrules</codeph>, to create start revision images
|
---|
77 | Output contents
|
---|
78 | Call <codeph>"end-revflag"</codeph> with <codeph>$flagrules</codeph>, to create end revision images
|
---|
79 | Call <codeph>"end-flagit"</codeph> with <codeph>$flagrules</codeph>, to create end flag images
|
---|
80 | Output end tag such as <codeph></div></codeph> or <codeph></span></codeph></lines></p><p>In
|
---|
81 | DITA-OT 1.7, style and images are typically handled with XSLT fallthrough
|
---|
82 | processing. This removes virtually all special flag coding from element
|
---|
83 | rules, because flags are already part of the document and processed
|
---|
84 | in document order. The sample above is reduced to:<lines>Match element
|
---|
85 | Output start tag such as <codeph><div></codeph> or <codeph><span></codeph>
|
---|
86 | Call <codeph>"commonattributes"</codeph> and ID processing
|
---|
87 | Output contents
|
---|
88 | Output end tag such as <codeph></div></codeph> or <codeph></span></codeph></lines></p></section>
|
---|
89 | <section><title>Migrating <codeph>"gen-style"</codeph> named template</title><p>Calls
|
---|
90 | to the <codeph>"gen-style"</codeph> template should be deleted. There
|
---|
91 | is no need to replace this call for most elements.</p><p>The <codeph>"gen-style"</codeph> template
|
---|
92 | was designed to read a DITAVAL file, find active style-based flagging
|
---|
93 | (such as colored or bold text), and add it to the generated @style
|
---|
94 | attribute in HTML.</p><p>With DITA-OT 1.7, the style is calculated
|
---|
95 | in the pre-process flagging module. The result is created as @outputclass
|
---|
96 | on a <codeph><ditaval-startprop></codeph> sub-element. The <codeph>"commonattributes"</codeph> template
|
---|
97 | now includes a line to process that value; the result is that for
|
---|
98 | every element that calls <codeph>"commonattributes"</codeph>, DITAVAL
|
---|
99 | style will be processed when needed. Because virtually every element
|
---|
100 | includes a call to this common template, there is little chance that
|
---|
101 | your override needs to explicitly process the style. The new line
|
---|
102 | in <codeph>"commonattributes"</codeph> that handles the style is: <codeblock><xsl:apply-templates select="*[contains(@class,' ditaot-d/ditaval-startprop ')]/@outputclass" mode="add-ditaval-style"/></codeblock></p></section>
|
---|
103 | <section><title>Migrating <codeph>"start-flagit"</codeph>, <codeph>"start-revflag"</codeph>, <codeph>"end-flagit"</codeph>,
|
---|
104 | and <codeph>"end-flagit"</codeph> named templates</title><p>Calls
|
---|
105 | to these templates fall into two general groups.</p><p>If the flow
|
---|
106 | of your element rule is to create a start tag like <codeph><div></codeph>, <codeph>"start-flagit"</codeph>/<codeph>"start-revflag"</codeph>,
|
---|
107 | process contents, <codeph>"end-revflag"</codeph>/<codeph>"end-flagit"</codeph>,
|
---|
108 | end tag - you just need to delete the calls to these templates. Flags
|
---|
109 | will be generated simply by processing the element contents in document
|
---|
110 | order.</p><p>If the flow of your element rule processes flags outside
|
---|
111 | of the normal document-order. There are generally two reasons this
|
---|
112 | is done. The first case is for elements like <codeph><ol></codeph>,
|
---|
113 | where flags must appear before the <codeph><ol></codeph> in order
|
---|
114 | to create valid XHTML. The second is for elements like <codeph><section></codeph>,
|
---|
115 | where start flags are created, followed by the title or some generated
|
---|
116 | text, element contents, and finally end flags. In either of these
|
---|
117 | cases, support for processing flags in document order is disabled,
|
---|
118 | so they must be explicitly processed out-of-line. This is done with
|
---|
119 | the following two lines (one for start flag/revision, one for end
|
---|
120 | flag/revision):<codeblock>Create starting flag and revision images:
|
---|
121 | <xsl:apply-templates select="*[contains(@class,' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
|
---|
122 |
|
---|
123 | Create ending flag and revision images:
|
---|
124 | <xsl:apply-templates select="*[contains(@class,' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/></codeblock></p><p>For
|
---|
125 | example, the following lines are used in DITA-OT 1.7 to process the <codeph><ul></codeph> element
|
---|
126 | (replacing the 29 lines used in DITA-OT 1.6):<codeblock><xsl:template match="*[contains(@class,' topic/ul ')]">
|
---|
127 | <b><xsl:apply-templates select="*[contains(@class,' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/></b>
|
---|
128 | <xsl:call-template name="setaname"/>
|
---|
129 | <ul>
|
---|
130 | <xsl:call-template name="commonattributes"/>
|
---|
131 | <xsl:apply-templates select="@compact"/>
|
---|
132 | <xsl:call-template name="setid"/>
|
---|
133 | <xsl:apply-templates/>
|
---|
134 | </ul>
|
---|
135 | <b><xsl:apply-templates select="*[contains(@class,' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/></b>
|
---|
136 | <xsl:value-of select="$newline"/>
|
---|
137 | </xsl:template></codeblock></p></section>
|
---|
138 | <section><title>Migrating <codeph>"start-flags-and-rev"</codeph> and <codeph>"end-flags-and-rev"</codeph></title><ul>
|
---|
139 | <li><codeph>"start-flags-and-rev"</codeph> is equivalent to calling <codeph>"start-flagit"</codeph> followed
|
---|
140 | by <codeph>"start-revflag"</codeph>; it should be migrated as in the
|
---|
141 | previous section.</li>
|
---|
142 | <li><codeph>"end-flags-and-rev"</codeph> is equivalent to calling <codeph>"end-revflag"</codeph> followed
|
---|
143 | by <codeph>"end-flagit"</codeph>; it should be migrated as in the
|
---|
144 | previous section.</li>
|
---|
145 | </ul></section>
|
---|
146 | <section><title>Migrating <codeph>"revblock"</codeph> and <codeph>"revtext"</codeph></title><p>Calls
|
---|
147 | to these two templates can be replaced with a simple call to <codeph><xsl:apply-templates/></codeph>.</p></section>
|
---|
148 | <section><title>Migrating modes <codeph>"outputContentsWithFlags"</codeph> and <codeph>"outputContentsWithFlagsAndStyle"</codeph></title><p>Processing
|
---|
149 | an element with either of these modes can be replaced with a simple
|
---|
150 | call to <codeph><xsl:apply-templates/></codeph>.</p></section>
|
---|
151 | <section><title>Migrating <codeph>mode="elementname-fmt"</codeph></title><p>Prior
|
---|
152 | to DITA-OT 1.7, many elements were processed with the following logic:<pre>Match element
|
---|
153 | Set variable to determine if revisions are active and $DRAFT is on
|
---|
154 | If active
|
---|
155 | create division with rev style
|
---|
156 | process element with mode="elementname-fmt"
|
---|
157 | end division
|
---|
158 | Else
|
---|
159 | process element with mode="elementname-fmt"
|
---|
160 |
|
---|
161 | Match element with mode="elementname-fmt"
|
---|
162 | Process as needed</pre></p><p>Beginning with DITA-OT 1.7, styling
|
---|
163 | from revisions is handled automatically with the <codeph>"commonattributes"</codeph> template.
|
---|
164 | This means there is no need for the extra testing, or the indirection
|
---|
165 | to <codeph>mode="elementname-fmt"</codeph>. These templates are deprecated,
|
---|
166 | and element processing will move into the main element rule. Overrides
|
---|
167 | that include this indirection may remove it; overrides should also
|
---|
168 | be sure to match the default rule, rather than matching with <codeph>mode="elementname-fmt"</codeph>.</p></section>
|
---|
169 | </refbody>
|
---|
170 | </reference>
|
---|