VirtualBox

source: vbox/trunk/src/libs/dita-ot-1.8.5/docsrc/dev_ref/flagging-migration.dita@ 99040

最後變更 在這個檔案從99040是 98584,由 vboxsync 提交於 2 年 前

Docs: bugref:10302. Setting svn properties of DITA-OT library.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette