Diff for Design for fix topicmerge
Fri, 2008-03-21 15:07 by robander | Tue, 2008-12-16 15:08 by robander | ||
---|---|---|---|
< previous diff | |||
Changes to Body | |||
Line 8 | Line 8 | ||
Topic merge in previous releases are written in xsl which calls document() to load different xml files into memory. But xsl transformation engine won't release the document tree once it gets loaded. This caused out of memory exception when merging large documents. Another bug in current topic merge is that the intermediate merged file lost the structure information in dita map and caused the structured toc can't be reflected in output.<br />
| Topic merge in previous releases are written in xsl which calls document() to load different xml files into memory. But xsl transformation engine won't release the document tree once it gets loaded. This caused out of memory exception when merging large documents. Another bug in current topic merge is that the intermediate merged file lost the structure information in dita map and caused the structured toc can't be reflected in output.<br />
| ||
<strong>Design Description:</strong><br />
| <strong>Design Description:</strong><br />
| ||
- | Use Java SAX to implement topic merge. When meeting with topicref in ditamap, the processor will read the dita topic and change all of its references to dita topic files into internal references. Then the processor will write the topic content with all of topicref information into the intermediate file. <br />
| + | <em>Removed information. The description did not accurately describe the latest topicmerge program and was causing confusion.</em>
|
- | For example,<br />
| + | |
- | a.ditamap looks like<br />
| + | |
- | <map><br />
| + | |
- | <topicref href="a.dita"><br />
| + | |
- | <topicref href="b.dita"/><br />
| + | |
- | </topicref><br />
| + | |
- | </map>
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | a.dita looks like<br />
| + | |
- | <topic id="a"><br />
| + | |
- | <title>a.dita</title><br />
| + | |
- | <body><br />
| + | |
- | <p><xref href="b.dita#b/test"/></p><br />
| + | |
- | </body><br />
| + | |
- | </topic>
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | b.dita looks like<br />
| + | |
- | <topic id="b"><br />
| + | |
- | <title>b.dita</title><br />
| + | |
- | <body><br />
| + | |
- | <p id="test">test paragraph</p><br />
| + | |
- | </body><br />
| + | |
- | </topic>
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | The merged output should be like this.<br />
| + | |
- | <map><br />
| + | |
- | <topicref href="a.dita"><br />
| + | |
- | <topic id="unique_1"><br />
| + | |
- | <title>a.dita</title><br />
| + | |
- | <body><br />
| + | |
- | <p><xref href="unique_3"/></p><br />
| + | |
- | </body><br />
| + | |
- | </topic><br />
| + | |
- | <topicref href="b.dita"><br />
| + | |
- | <topic id="unique_2"><br />
| + | |
- | <title>b.dita</title><br />
| + | |
- | <body><br />
| + | |
- | <p id="unique_3">test paragraph</p><br />
| + | |
- | </body><br />
| + | |
- | </topic><br />
| + | |
- | </topicref><br />
| + | |
- | </topicref><br />
| + | |
- | </map>
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | The merged output above will be first stored in memory as string. If there is not additional xsl applied to this result, it will be generated to the merged file. Otherwise the user defined xsl should be applied to the result and output to merged file.
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | Duplicate resolution:<br />
| + | |
- | XSL-FO doesn't allow duplicate id. When a dita file is topicref'd more than once in ditamap, we need to mark up the duplicate version of content in the merged output and assign different ids to them.<br />
| + | |
- | During the processing, we will use a hashtable to record the mapping between original id and the unique id we assigned in the merged result. In the exmaple above, the id of the paragraph in b.dita is b.dita#b/test. The unique id we assigned in merge result is unique_3. So there will be an entry in the hashtable. The key of the entry is b.dita#b/test and the value is unique_3. <br />
| + | |
- | If we modified the ditamap to include b.dita twice as following:
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | <map><br />
| + | |
- | <topicref href="a.dita"><br />
| + | |
- | <topicref href="b.dita"/><br />
| + | |
- | </topicref><br />
| + | |
- | <topicref href="b.dita"/><br />
| + | |
- | </map><br />
| + | |
- | then the second b.dita will be record as b.dita(d<random_num>) . In the hash table there will be key value b.dita(d<random_num>) and b.dita(d<random_num>)#b/test. <random_num>is generated randomly. It is not likely to have the same <random_num>for different duplicate content if the author doesn't include the same file in ditamap that much. The possible merged result looks like:<br />
| + | |
- | <map><br />
| + | |
- | <topicref href="a.dita"><br />
| + | |
- | <topic id="unique_1"><br />
| + | |
- | <title>a.dita</title><br />
| + | |
- | <body><br />
| + | |
- | <p><xref href="unique_3"/></p><br />
| + | |
- | </body><br />
| + | |
- | </topic><br />
| + | |
- | <topicref href="b.dita"><br />
| + | |
- | <topic id="unique_2"><br />
| + | |
- | <title>b.dita</title><br />
| + | |
- | <body><br />
| + | |
- | <p id="unique_3">test paragraph</p><br />
| + | |
- | </body><br />
| + | |
- | </topic><br />
| + | |
- | </topicref><br />
| + | |
- | </topicref><br />
| + | |
- | <topicref href="b.dita(d123523)"><br />
| + | |
- | <topic id="unique_4"><br />
| + | |
- | <title>b.dita</title><br />
| + | |
- | <body><br />
| + | |
- | <p id="unique_5">test paragraph</p><br />
| + | |
- | </body><br />
| + | |
- | </topic><br />
| + | |
- | </topicref><br />
| + | |
- | </map>
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | If there is a <xref> in b.dita which refer to the paragraph in the same file the merged result could be:
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | <map><br />
| + | |
- | <topicref href="a.dita"><br />
| + | |
- | <topic id="unique_1"><br />
| + | |
- | <title>a.dita</title><br />
| + | |
- | <body><br />
| + | |
- | <p><xref href="unique_3"/></p><br />
| + | |
- | </body><br />
| + | |
- | </topic><br />
| + | |
- | <topicref href="b.dita"><br />
| + | |
- | <topic id="unique_2"><br />
| + | |
- | <title>b.dita</title><br />
| + | |
- | <body><br />
| + | |
- | <p id="unique_3">test paragraph</p><br />
| + | |
- | <xref href="unique_3"/><br />
| + | |
- | </body><br />
| + | |
- | </topic><br />
| + | |
- | </topicref><br />
| + | |
- | </topicref><br />
| + | |
- | <topicref href="b.dita(d123523)"><br />
| + | |
- | <topic id="unique_4"><br />
| + | |
- | <title>b.dita</title><br />
| + | |
- | <body><br />
| + | |
- | <p id="unique_5">test paragraph</p><br />
| + | |
- | <xref href="unique_5"/><br />
| + | |
- | </body><br />
| + | |
- | </topic><br />
| + | |
- | </topicref><br />
| + | |
- | </map><br />
| + | |
- | The duplicate <xref> should point to the duplicate <p> because they are in the same file.
| + | |
</p>
| </p>
| ||
Design for fix topicmerge
Note: This information has not been updated since original creation, and may no longer be up to date. It is still here for reference. Up to date information on the toolkit can be found here: The DITA Open Toolkit
Requirement/Problem:
Topic merge in previous releases are written in xsl which calls document() to load different xml files into memory. But xsl transformation engine won't release the document tree once it gets loaded. This caused out of memory exception when merging large documents. Another bug in current topic merge is that the intermediate merged file lost the structure information in dita map and caused the structured toc can't be reflected in output.
Design Description:
Removed information. The description did not accurately describe the latest topicmerge program and was causing confusion.