Skip to content

Commit c79aa59

Browse files
committed
Updates
1 parent 214bf65 commit c79aa59

File tree

10 files changed

+279
-12
lines changed

10 files changed

+279
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
3+
<topic id="introduction">
4+
<title>Taking care of flowers</title>
5+
<shortdesc>With just a little bit of care and preparation, any flower garden can be a vibrantly
6+
colored environment.</shortdesc>
7+
<body>
8+
<p>With just a little bit of care and preparation, any flower garden can be a vibrantly
9+
colored environment. Flowers can be selected for specific blooming seasons, colors and
10+
shapes. Both annual and <xref keyref="perennial" format="dita">perennial</xref> flower
11+
gardens can be planted depending on climate and specific needs.</p>
12+
<section id="section_kfc_zs4_jhb">
13+
<title>Care and pruning</title>
14+
<p>When caring for your flower garden you want to feed your plants properly, control
15+
pests and weeds. Good soil is a must to successful gardening, landscaping, and
16+
healthy flowers. You have to
17+
<indexterm>tasks<indexterm>preparation</indexterm></indexterm>balance the soil
18+
structure with nutrients and regulate the pH to cover your plants'
19+
needs.<?oxy_comment_start author="Mary" timestamp="20120510T121702+0300" comment="Let&apos;s add information about fertilizers."?><?oxy_comment_start author="John" timestamp="20120510T121814+0300" comment="We must include information about fertilizers impact to the environment." mid="1"?>
20+
And above all, remember that many flower gardens fail because they just don't get
21+
enough of your attention.<?oxy_comment_end?><?oxy_comment_end mid="1"?></p>
22+
</section>
23+
</body>
24+
</topic>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
3+
<map>
4+
<title>Main</title>
5+
<topicref href="introduction.dita"/>
6+
</map>

3.3 Change DTD/changeDtd.xml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<refactoringOperationDescriptor
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns="http://www.oxygenxml.com/ns/xmlRefactoring" id="changedtd" name="Change DTDs">
5+
<description>Change DTD</description>
6+
<script type="XSLT" href="changeDtd.xsl"/>
7+
</refactoringOperationDescriptor>

3.3 Change DTD/changeDtd.xsl

+182
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
4+
xmlns:xr="http://www.oxygenxml.com/ns/xmlRefactoring"
5+
xmlns:oxy="http://www.oxygenxml.com/ns/extensions"
6+
xmlns:xrf="http://www.oxygenxml.com/ns/xmlRefactoring/functions"
7+
xmlns:r="http://www.oxygenxml.com/ns/xmlRefactoring/functions"
8+
exclude-result-prefixes="xs xr xrf r"
9+
version="2.0">
10+
11+
<xsl:output method="xml"/>
12+
13+
<xsl:function name="oxy:get-public-literal-target">
14+
<xsl:param name="root-element-name"/>
15+
<xsl:choose>
16+
<xsl:when test="$root-element-name = 'task'">
17+
<xsl:value-of select="'-//OASIS//DTD DITA My Task//EN'"/>
18+
</xsl:when>
19+
<xsl:when test="$root-element-name = 'topic'">
20+
<xsl:value-of select="'-//OASIS//DTD DITA My Topic//EN'"/>
21+
</xsl:when>
22+
<xsl:when test="$root-element-name = 'concept'">
23+
<xsl:value-of select="'-//OASIS//DTD DITA My Concept//EN'"/>
24+
</xsl:when>
25+
<xsl:when test="$root-element-name = 'reference'">
26+
<xsl:value-of select="'-//OASIS//DTD DITA My Reference//EN'"/>
27+
</xsl:when>
28+
</xsl:choose>
29+
</xsl:function>
30+
31+
<xsl:function name="oxy:get-system-literal-target">
32+
<xsl:param name="root-element-name"/>
33+
<xsl:choose>
34+
<xsl:when test="$root-element-name = 'task'">
35+
<xsl:value-of select="'mytask.dtd'"/>
36+
</xsl:when>
37+
<xsl:when test="$root-element-name = 'topic'">
38+
<xsl:value-of select="'mytopic.dtd'"/>
39+
</xsl:when>
40+
<xsl:when test="$root-element-name = 'concept'">
41+
<xsl:value-of select="'myconcept.dtd'"/>
42+
</xsl:when>
43+
<xsl:when test="$root-element-name = 'reference'">
44+
<xsl:value-of select="'myreference.dtd'"/>
45+
</xsl:when>
46+
</xsl:choose>
47+
</xsl:function>
48+
49+
<xsl:template match="/">
50+
<xsl:call-template name="convert-header"/>
51+
<xsl:copy-of select="."/>
52+
</xsl:template>
53+
54+
<xsl:template name="convert-header">
55+
56+
<xsl:variable name="header" as="xs:string" select="xrf:get-content-before-root()"/>
57+
58+
<xsl:variable name="root-element-name" select="local-name(/*)"/>
59+
<xsl:choose>
60+
<!-- DOCTYPE -->
61+
<xsl:when test="contains($header, '!DOCTYPE')">
62+
<!-- Convert the DOCTYPE -->
63+
<xsl:variable name="converted-header">
64+
<xsl:analyze-string select="$header" regex="{r:doctype-regex()}" flags="ims">
65+
<xsl:matching-substring>
66+
<xsl:variable name="doctype" select="." as="xs:string"/>
67+
68+
<!-- Extract the internal subset within the DOCTYPE !-->
69+
<xsl:variable name="internal-subset" as="xs:string">
70+
<xsl:choose>
71+
<xsl:when test="contains($doctype, '[')">
72+
<xsl:analyze-string select="." regex="\[[^\]]*\]">
73+
<xsl:matching-substring>
74+
<xsl:value-of select="concat(' ', .)"/>
75+
</xsl:matching-substring>
76+
</xsl:analyze-string>
77+
</xsl:when>
78+
<xsl:otherwise>
79+
<xsl:value-of select="''"/>
80+
</xsl:otherwise>
81+
</xsl:choose>
82+
</xsl:variable>
83+
84+
<xsl:value-of
85+
select="concat('&lt;!DOCTYPE ', $root-element-name, ' PUBLIC &quot;', oxy:get-public-literal-target($root-element-name), '&quot; &quot;', oxy:get-system-literal-target($root-element-name), '&quot;', $internal-subset, '&gt;')"
86+
/>
87+
</xsl:matching-substring>
88+
89+
<!-- Copy everything else -->
90+
<xsl:non-matching-substring>
91+
<xsl:value-of select="."/>
92+
</xsl:non-matching-substring>
93+
</xsl:analyze-string>
94+
</xsl:variable>
95+
96+
<xsl:comment>
97+
<xsl:value-of
98+
select="xrf:set-content-before-root(string-join($converted-header))"/>
99+
</xsl:comment>
100+
</xsl:when>
101+
<xsl:otherwise>
102+
<xsl:variable name="converted-header">
103+
<xsl:value-of
104+
select="concat('&lt;!DOCTYPE ', $root-element-name, ' PUBLIC &quot;', oxy:get-public-literal-target($root-element-name), '&quot; &quot;', oxy:get-system-literal-target($root-element-name), '&quot;','&gt;')"
105+
/>
106+
</xsl:variable>
107+
<xsl:comment>
108+
<xsl:value-of
109+
select="xrf:set-content-before-root(string-join($converted-header))"/>
110+
</xsl:comment>
111+
</xsl:otherwise>
112+
</xsl:choose>
113+
</xsl:template>
114+
115+
<!-- One or more spaces. -->
116+
<xsl:variable name="S">
117+
<xsl:text>([ \t\r\n]+)</xsl:text>
118+
</xsl:variable>
119+
120+
<!--
121+
Returns a regex expression that match the DOCTYPE declaration.
122+
-->
123+
<xsl:function name="xrf:doctype-regex" as="xs:string">
124+
<!-- DOCTYPE regex -->
125+
<xsl:variable name="doctype-regex">
126+
<xsl:variable name="DOCTYPE" select="'!DOCTYPE'"/>
127+
128+
<!-- '<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>' -->
129+
<!--<xsl:value-of select="concat('(', $S, xrf:external-id-regex(), ')')"/>-->
130+
<xsl:value-of
131+
select="concat('&lt;', $DOCTYPE, $S, xrf:name(), '(', $S, xrf:external-id(), ')?', $S, '?', '(\[[^\]]*\]', $S, '?)?', '&gt;')"
132+
/>
133+
<!--<xsl:value-of select="'\[[^\]]*\]'"/>-->
134+
135+
</xsl:variable>
136+
137+
<xsl:value-of select="$doctype-regex"/>
138+
</xsl:function>
139+
140+
<!--
141+
Returns a regex expression that match a Name declaration within DOCTYPE.
142+
-->
143+
<xsl:function name="xrf:name">
144+
<xsl:variable name="NameStartChar">
145+
<xsl:text>(:|[A-Za-z]|_|[&#x00C0;-&#x00D6;]|[&#x00D8;-&#x00F6;]|[&#x00F8;-&#x02FF;]|[&#x0370;-&#x037D;]|[&#x037F;-&#x1FFF;]|[&#x200C;-&#x200D;]|[&#x2070;-&#x218F;]|[&#x2C00;-&#x2FEF;]|[&#x3001;-&#xD7FF;]|[&#xF900;-&#xFDCF;]|[&#xFDF0;-&#xFFFD;])</xsl:text>
146+
</xsl:variable>
147+
148+
<xsl:variable name="NameChar">
149+
<xsl:value-of
150+
select="concat($NameStartChar, '|-|\.|[0-9]|&#x00B7;|[&#x0300;-&#x036F;]|[&#x203F;-&#x2040;]')"
151+
/>
152+
</xsl:variable>
153+
154+
<xsl:value-of select="concat($NameStartChar, '(', $NameChar, ')*')"/>
155+
</xsl:function>
156+
157+
<!--
158+
Returns a regex expression that match the external id within DOCTYPE.
159+
-->
160+
<xsl:function name="xrf:external-id">
161+
<xsl:variable name="SystemLiteral">
162+
<xsl:text>(("[^"]*")|('[^']*'))</xsl:text>
163+
</xsl:variable>
164+
165+
<xsl:variable name="PubidLiteral">
166+
<xsl:variable name="PubIdCharSQ">
167+
<xsl:text>[&#x0020;\r\n]|[a-zA-Z0-9]|[\-\(\)+,\./:=\?;!\*#@$_%]</xsl:text>
168+
</xsl:variable>
169+
170+
<xsl:variable name="sq">'</xsl:variable>
171+
<xsl:variable name="PubIdCharDQ">
172+
<xsl:value-of select="concat($PubIdCharSQ, '|', $sq)"/>
173+
</xsl:variable>
174+
<xsl:value-of
175+
select="concat('((&quot;(', $PubIdCharDQ, ')*&quot;)|(', $sq, '(', $PubIdCharSQ, ')*', $sq, '))')"
176+
/>
177+
</xsl:variable>
178+
<xsl:value-of
179+
select="concat('((SYSTEM', $S, $SystemLiteral, ')|(', 'PUBLIC', $S, $PubidLiteral, $S, $SystemLiteral, '))')"
180+
/>
181+
</xsl:function>
182+
</xsl:stylesheet>
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
3+
<concept id="my_concept">
4+
<title>My Concept</title>
5+
<shortdesc></shortdesc>
6+
<conbody>
7+
<p></p>
8+
</conbody>
9+
</concept>
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
3+
<reference id="my_reference">
4+
<title>My Reference</title>
5+
<shortdesc></shortdesc>
6+
<refbody> </refbody>
7+
</reference>

3.3 Change DTD/samples/my_task.dita

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
3+
<task id="my_task">
4+
<title>My Task</title>
5+
<shortdesc></shortdesc>
6+
<taskbody>
7+
<context>
8+
<p></p>
9+
</context>
10+
<steps>
11+
<step>
12+
<cmd></cmd>
13+
</step>
14+
</steps>
15+
</taskbody>
16+
</task>

3.3 Change DTD/samples/my_topic.dita

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
3+
<topic id="my_topic">
4+
<title>My Topic</title>
5+
<body>
6+
<p></p>
7+
</body>
8+
</topic>

restructure-dita.odp

8.75 KB
Binary file not shown.

restructureDITA.xpr

+20-12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
<options>
66
<serialized version="21.0" xml:space="preserve">
77
<serializableOrderedMap>
8+
<entry>
9+
<String>custom.refactoring.dir</String>
10+
<String>${pd}</String>
11+
</entry>
12+
<entry>
13+
<String>key.xml.refactoring.option.pane</String>
14+
<Boolean>true</Boolean>
15+
</entry>
816
<entry>
917
<String>scenario.associations</String>
1018
<scenarioAssociation-array>
@@ -40,11 +48,11 @@
4048
</scenarioAssociation>
4149
<scenarioAssociation>
4250
<field name="url">
43-
<String>5.%20Delete%20Key/test_topic.dita</String>
51+
<String>2.%20DB%20to%20DITA/sampleXInclude.dita</String>
4452
</field>
4553
<field name="scenarioIds">
4654
<list>
47-
<String>Delete Key</String>
55+
<String>Split DITA</String>
4856
</list>
4957
</field>
5058
<field name="scenarioTypes">
@@ -55,16 +63,16 @@
5563
</scenarioAssociation>
5664
<scenarioAssociation>
5765
<field name="url">
58-
<String>2.%20DB%20to%20DITA/sampleXInclude.dita</String>
66+
<String>1.%20XSLT%20apply%20with%20strip%20DOCTYPE/build.xml</String>
5967
</field>
6068
<field name="scenarioIds">
6169
<list>
62-
<String>Split DITA</String>
70+
<String>ANT (with Saxon 9 EE XSLT support) - Copy</String>
6371
</list>
6472
</field>
6573
<field name="scenarioTypes">
6674
<list>
67-
<String>XSL</String>
75+
<String>ANT</String>
6876
</list>
6977
</field>
7078
</scenarioAssociation>
@@ -85,11 +93,11 @@
8593
</scenarioAssociation>
8694
<scenarioAssociation>
8795
<field name="url">
88-
<String>14%20Cals%20Table%20To%20Simple%20Table/test_topic.dita</String>
96+
<String>5.%20Delete%20Key/test_topic.dita</String>
8997
</field>
9098
<field name="scenarioIds">
9199
<list>
92-
<String>CALS to Simple Table</String>
100+
<String>Delete Key</String>
93101
</list>
94102
</field>
95103
<field name="scenarioTypes">
@@ -100,11 +108,11 @@
100108
</scenarioAssociation>
101109
<scenarioAssociation>
102110
<field name="url">
103-
<String>6.%20Image%20Href%20to%20Keyref/testtopic.dita</String>
111+
<String>14%20Cals%20Table%20To%20Simple%20Table/test_topic.dita</String>
104112
</field>
105113
<field name="scenarioIds">
106114
<list>
107-
<String>Image href to keyref</String>
115+
<String>CALS to Simple Table</String>
108116
</list>
109117
</field>
110118
<field name="scenarioTypes">
@@ -115,16 +123,16 @@
115123
</scenarioAssociation>
116124
<scenarioAssociation>
117125
<field name="url">
118-
<String>1.%20XSLT%20apply%20with%20strip%20DOCTYPE/build.xml</String>
126+
<String>6.%20Image%20Href%20to%20Keyref/testtopic.dita</String>
119127
</field>
120128
<field name="scenarioIds">
121129
<list>
122-
<String>ANT (with Saxon 9 EE XSLT support) - Copy</String>
130+
<String>Image href to keyref</String>
123131
</list>
124132
</field>
125133
<field name="scenarioTypes">
126134
<list>
127-
<String>ANT</String>
135+
<String>XSL</String>
128136
</list>
129137
</field>
130138
</scenarioAssociation>

0 commit comments

Comments
 (0)