| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
|---|
| 2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|---|
| 3 | xmlns:dfx="http://www.topologi.org/2004/Diff-X" |
|---|
| 4 | xmlns:del="http://www.topologi.org/2004/Diff-X/Delete" |
|---|
| 5 | xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage" |
|---|
| 6 | xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" |
|---|
| 7 | xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" |
|---|
| 8 | xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" |
|---|
| 9 | xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" |
|---|
| 10 | xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" |
|---|
| 11 | xmlns:java="http://xml.apache.org/xalan/java" |
|---|
| 12 | xmlns:xml="http://www.w3.org/XML/1998/namespace" |
|---|
| 13 | xmlns:xalan="http://xml.apache.org/xalan" |
|---|
| 14 | |
|---|
| 15 | version="1.0" |
|---|
| 16 | exclude-result-prefixes="java"> |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | <!-- |
|---|
| 20 | * Copyright 2007, Plutext Pty Ltd. |
|---|
| 21 | * |
|---|
| 22 | * This file is part of plutext-client-word2007. |
|---|
| 23 | |
|---|
| 24 | plutext-client-word2007 is free software: you can redistribute it and/or |
|---|
| 25 | modify it under the terms of version 3 of the GNU General Public License |
|---|
| 26 | as published by the Free Software Foundation. |
|---|
| 27 | |
|---|
| 28 | plutext-client-word2007 is distributed in the hope that it will be |
|---|
| 29 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
|---|
| 30 | of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 31 | GNU General Public License for more details. |
|---|
| 32 | |
|---|
| 33 | You should have received a copy of the GNU General Public License |
|---|
| 34 | along with plutext-client-word2007. If not, see |
|---|
| 35 | <http://www.gnu.org/licenses/>. |
|---|
| 36 | |
|---|
| 37 | --> |
|---|
| 38 | |
|---|
| 39 | <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no" |
|---|
| 40 | indent="yes" xalan:indent-amount="4" /> |
|---|
| 41 | |
|---|
| 42 | <xsl:param name="Differencer"/> |
|---|
| 43 | <xsl:param name="author"/> |
|---|
| 44 | <xsl:param name="date"/> |
|---|
| 45 | <!-- NB: do not set date to an empty string, |
|---|
| 46 | or |
|---|
| 47 | |
|---|
| 48 | java.lang.IllegalArgumentException: |
|---|
| 49 | at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parseAndSetYear(XMLGregorianCalendarImpl.java:2850) |
|---|
| 50 | at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse(XMLGregorianCalendarImpl.java:2737) |
|---|
| 51 | at com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl.<init>(XMLGregorianCalendarImpl.java:433) |
|---|
| 52 | at com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(DatatypeFactoryImpl.java:230) |
|---|
| 53 | at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$13.parse(RuntimeBuiltinLeafInfoImpl.java:546) |
|---|
| 54 | |
|---|
| 55 | --> |
|---|
| 56 | |
|---|
| 57 | <xsl:param name="docPartRelsLeft"/> |
|---|
| 58 | <xsl:param name="docPartRelsRight"/> |
|---|
| 59 | <xsl:param name="relsDiffIdentifier"/> |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | <xsl:preserve-space elements="ins del w:t"/> |
|---|
| 63 | |
|---|
| 64 | <xsl:template match="/ | @*|node()"> |
|---|
| 65 | <xsl:copy> |
|---|
| 66 | <xsl:apply-templates select="@*|node()"/> |
|---|
| 67 | </xsl:copy> |
|---|
| 68 | </xsl:template> |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | <!-- do we really want to do this???? --> |
|---|
| 72 | <xsl:template match="@del:val"> |
|---|
| 73 | <xsl:attribute name="w:val"><xsl:value-of select="."/></xsl:attribute> |
|---|
| 74 | </xsl:template> |
|---|
| 75 | |
|---|
| 76 | <xsl:template match="@del:*"/> |
|---|
| 77 | |
|---|
| 78 | <!-- |
|---|
| 79 | <xsl:template match="*[@dfx:insert='true']" > |
|---|
| 80 | <xsl:copy> |
|---|
| 81 | <xsl:apply-templates select="@*|node()"/> |
|---|
| 82 | </xsl:copy> |
|---|
| 83 | |
|---|
| 84 | </xsl:template> |
|---|
| 85 | --> |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | <!-- |
|---|
| 91 | |
|---|
| 92 | In the case of <w:p dfx:delete="true">, |
|---|
| 93 | there are 3 distinct cases we need to handle: |
|---|
| 94 | |
|---|
| 95 | The first is simple. It occurs when a paragraph has been |
|---|
| 96 | deleted. For that we want to end up with: |
|---|
| 97 | |
|---|
| 98 | <w:p> |
|---|
| 99 | <w:pPr> |
|---|
| 100 | <w:rPr><w:del ...> <~~~~~~~ |
|---|
| 101 | |
|---|
| 102 | <w:r><w:delText>.... |
|---|
| 103 | |
|---|
| 104 | The second is more complex. It occurs |
|---|
| 105 | when diffing two paragraphs results in: |
|---|
| 106 | |
|---|
| 107 | <w:p dfx:insert="true"> |
|---|
| 108 | <w:p dfx:delete="true"> |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | The third is the converse of the second. |
|---|
| 112 | I haven't seen it in a real document, but ... |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | --> |
|---|
| 116 | <xsl:template match="w:p[@dfx:delete and not(parent::w:p)]"> |
|---|
| 117 | <!-- We need a paragraph in the document, |
|---|
| 118 | to contain the deleted content. --> |
|---|
| 119 | <xsl:comment>Handling simple deleted w:p</xsl:comment> |
|---|
| 120 | <w:p> |
|---|
| 121 | <xsl:apply-templates/> |
|---|
| 122 | </w:p> |
|---|
| 123 | </xsl:template> |
|---|
| 124 | |
|---|
| 125 | <xsl:template match="w:p[@dfx:delete and parent::w:p]"> |
|---|
| 126 | <!-- Drop this element, since there is a suitable |
|---|
| 127 | parent p in the document to contain the |
|---|
| 128 | content; |
|---|
| 129 | retain children |
|---|
| 130 | unless they to have the dfx:delete attribute --> |
|---|
| 131 | <xsl:comment>Handling diffx nested w:p</xsl:comment> |
|---|
| 132 | <xsl:apply-templates/> |
|---|
| 133 | </xsl:template> |
|---|
| 134 | |
|---|
| 135 | <!-- Just in case? --> |
|---|
| 136 | <xsl:template match="w:p[@dfx:insert and parent::w:p]"> |
|---|
| 137 | <!-- Drop this element, since there is a suitable |
|---|
| 138 | parent p in the document to contain the |
|---|
| 139 | content --> |
|---|
| 140 | <xsl:comment>Handling diffx nested w:p case3</xsl:comment> |
|---|
| 141 | <xsl:apply-templates/> |
|---|
| 142 | </xsl:template> |
|---|
| 143 | |
|---|
| 144 | |
|---|
| 145 | <xsl:template match="@dfx:insert" /> |
|---|
| 146 | |
|---|
| 147 | |
|---|
| 148 | <xsl:template match="*[@dfx:delete and not(self::w:p)]"> |
|---|
| 149 | <!-- Drop this element, but retain its children |
|---|
| 150 | unless they to have the dfx:delete attribute. |
|---|
| 151 | |
|---|
| 152 | A consequence of this is that images will |
|---|
| 153 | disappear without trace? |
|---|
| 154 | |
|---|
| 155 | <w:p dfx:delete="true"> |
|---|
| 156 | <w:r dfx:delete="true"> |
|---|
| 157 | <w:rPr dfx:delete="true"><w:noProof dfx:delete="true" /></w:rPr> |
|---|
| 158 | <w:drawing dfx:delete="true"><wp:inline dfx:delete="true" del:distB="0" del:distL="0" del:distR="0" del:distT="0"><wp:extent dfx:delete="true" del:cx="3143250" del:cy="2286000" /><wp:effectExtent dfx:delete="true" del:b="0" del:l="19050" del:r="0" del:t="0" /><wp:docPr dfx:delete="true" del:descr="http://venturebeat.com/wp-content/uploads/2009/01/imvu.jpg" del:id="2" del:name="Picture 1" /><wp:cNvGraphicFramePr dfx:delete="true"><a:graphicFrameLocks dfx:delete="true" del:noChangeAspect="1" /></wp:cNvGraphicFramePr><a:graphic dfx:delete="true"><a:graphicData dfx:delete="true" del:uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic dfx:delete="true"><pic:nvPicPr dfx:delete="true"><pic:cNvPr dfx:delete="true" del:descr="http://venturebeat.com/wp-content/uploads/2009/01/imvu.jpg" del:id="0" del:name="Picture 1" /><pic:cNvPicPr dfx:delete="true"><a:picLocks dfx:delete="true" del:noChangeArrowheads="1" del:noChangeAspect="1" /></pic:cNvPicPr></pic:nvPicPr><pic:blipFill dfx:delete="true"><a:blip dfx:delete="true" del:link="rId4" /><a:srcRect dfx:delete="true" /><a:stretch dfx:delete="true"><a:fillRect dfx:delete="true" /></a:stretch></pic:blipFill><pic:spPr dfx:delete="true" del:bwMode="auto"><a:xfrm dfx:delete="true"><a:off dfx:delete="true" del:x="0" del:y="0" /><a:ext dfx:delete="true" del:cx="3143250" del:cy="2286000" /></a:xfrm><a:prstGeom dfx:delete="true" del:prst="rect"><a:avLst dfx:delete="true" /></a:prstGeom><a:noFill dfx:delete="true" /><a:ln dfx:delete="true" del:w="9525"><a:noFill dfx:delete="true" /><a:miter dfx:delete="true" del:lim="800000" /><a:headEnd dfx:delete="true" /><a:tailEnd dfx:delete="true" /></a:ln></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing> |
|---|
| 159 | </w:r> |
|---|
| 160 | </w:p> |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | --> |
|---|
| 164 | <xsl:apply-templates/> |
|---|
| 165 | </xsl:template> |
|---|
| 166 | |
|---|
| 167 | |
|---|
| 168 | |
|---|
| 169 | <xsl:template match="w:rPr[@dfx:delete='true'] " mode="omitDeletions"> |
|---|
| 170 | <xsl:comment>rPr had @dfx:delete='true', so left out.</xsl:comment> |
|---|
| 171 | </xsl:template> |
|---|
| 172 | |
|---|
| 173 | <xsl:template match="w:rPr[not(@dfx:delete='true')] " mode="omitDeletions"> |
|---|
| 174 | <!-- Handle eg |
|---|
| 175 | |
|---|
| 176 | <w:rPr dfx:insert="true"><w:b dfx:insert="true" /></w:rPr>< |
|---|
| 177 | |
|---|
| 178 | --> |
|---|
| 179 | <xsl:copy> |
|---|
| 180 | <xsl:apply-templates select="@*|node()"/> |
|---|
| 181 | </xsl:copy> |
|---|
| 182 | </xsl:template> |
|---|
| 183 | |
|---|
| 184 | |
|---|
| 185 | <xsl:template match="w:r"> |
|---|
| 186 | |
|---|
| 187 | <xsl:apply-templates select="w:t|w:tab|w:drawing|w:commentReference|w:sym|w:footnoteReference|w:endnoteReference"/> |
|---|
| 188 | <!-- NB: this XSLT drops run content other than these. What else to keep? --> |
|---|
| 189 | |
|---|
| 190 | </xsl:template> |
|---|
| 191 | |
|---|
| 192 | <!-- We don't lose our rPr or w:t elements here, |
|---|
| 193 | because they are put in by the template |
|---|
| 194 | matching on text(). --> |
|---|
| 195 | |
|---|
| 196 | <xsl:template match="w:t"> |
|---|
| 197 | |
|---|
| 198 | <xsl:apply-templates select="node()"/> |
|---|
| 199 | |
|---|
| 200 | </xsl:template> |
|---|
| 201 | |
|---|
| 202 | <!-- Handle <w:sym w:font="Wingdings" w:char="F04A" /> --> |
|---|
| 203 | <xsl:template match="w:sym"> |
|---|
| 204 | <w:r> |
|---|
| 205 | <xsl:apply-templates select="../../w:rPr" mode="omitDeletions"/> |
|---|
| 206 | <xsl:copy> |
|---|
| 207 | <xsl:apply-templates select="@*|node()"/> |
|---|
| 208 | </xsl:copy> |
|---|
| 209 | </w:r> |
|---|
| 210 | </xsl:template> |
|---|
| 211 | |
|---|
| 212 | <xsl:template match="w:sectPr"> |
|---|
| 213 | <xsl:copy> |
|---|
| 214 | <xsl:apply-templates select="@*|node()"/> |
|---|
| 215 | </xsl:copy> |
|---|
| 216 | </xsl:template> |
|---|
| 217 | |
|---|
| 218 | <!-- Drop these. |
|---|
| 219 | If you want them, you'll need to attend to their r:id, using |
|---|
| 220 | java:org.docx4j.diff.Differencer.registerRelationship |
|---|
| 221 | (see example below) --> |
|---|
| 222 | <xsl:template match="w:headerReference" /> |
|---|
| 223 | <xsl:template match="w:footerReference" /> |
|---|
| 224 | |
|---|
| 225 | <!-- w:drawing: there are 3 cases: |
|---|
| 226 | |
|---|
| 227 | (1) drawing deleted (ie present in RHS only) |
|---|
| 228 | (2) drawing, inserted in LHS |
|---|
| 229 | |
|---|
| 230 | (3) normal drawing, present in LHS & RHS |
|---|
| 231 | |
|---|
| 232 | --> |
|---|
| 233 | |
|---|
| 234 | <xsl:template match="w:drawing" priority="3"> |
|---|
| 235 | |
|---|
| 236 | <xsl:variable name="logdummy" |
|---|
| 237 | select="java:org.docx4j.diff.Differencer.log('in my w:drawing template')" /> |
|---|
| 238 | |
|---|
| 239 | <xsl:choose> |
|---|
| 240 | <xsl:when test="@dfx:delete='true'"> |
|---|
| 241 | <xsl:variable name="id" |
|---|
| 242 | select="java:org.docx4j.diff.Differencer.getId()" /> |
|---|
| 243 | <w:del w:id="{$id}" w:author="{$author}" w:date="{$date}"> <!-- w:date is optional --> |
|---|
| 244 | <w:r> |
|---|
| 245 | <xsl:copy> |
|---|
| 246 | <xsl:apply-templates select="node()"/> <!-- drop @ --> |
|---|
| 247 | </xsl:copy> |
|---|
| 248 | </w:r> |
|---|
| 249 | </w:del> |
|---|
| 250 | </xsl:when> |
|---|
| 251 | <xsl:when test="@dfx:insert='true'"> |
|---|
| 252 | <xsl:variable name="id" |
|---|
| 253 | select="java:org.docx4j.diff.Differencer.getId()" /> |
|---|
| 254 | <w:ins w:id="{$id}" w:author="{$author}" w:date="{$date}"> <!-- w:date is optional --> |
|---|
| 255 | <w:r> |
|---|
| 256 | <xsl:copy> |
|---|
| 257 | <xsl:apply-templates select="node()"/> <!-- drop @ --> |
|---|
| 258 | </xsl:copy> |
|---|
| 259 | </w:r> |
|---|
| 260 | </w:ins> |
|---|
| 261 | </xsl:when> |
|---|
| 262 | <xsl:otherwise> |
|---|
| 263 | <w:r> |
|---|
| 264 | <xsl:copy> |
|---|
| 265 | <xsl:apply-templates select="node()"/> <!-- drop @, though there shouldn't be any --> |
|---|
| 266 | </xsl:copy> |
|---|
| 267 | </w:r> |
|---|
| 268 | </xsl:otherwise> |
|---|
| 269 | </xsl:choose> |
|---|
| 270 | |
|---|
| 271 | </xsl:template> |
|---|
| 272 | |
|---|
| 273 | |
|---|
| 274 | <xsl:template match="a:blip" priority="5"> |
|---|
| 275 | |
|---|
| 276 | <xsl:choose> |
|---|
| 277 | <!-- case (1) drawing deleted (ie present in RHS only) --> |
|---|
| 278 | <xsl:when test="@dfx:delete='true'"> |
|---|
| 279 | <!-- Handle link|embed --> |
|---|
| 280 | <xsl:choose> |
|---|
| 281 | <xsl:when test="count(@del:link)=1"> |
|---|
| 282 | <xsl:variable name="oldid" select="string(@del:link)" /> |
|---|
| 283 | <xsl:variable name="newid" select="concat($oldid, 'R', $relsDiffIdentifier)" /> <!-- From RIGHT rels --> |
|---|
| 284 | <xsl:variable name="dummy" |
|---|
| 285 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 286 | $Differencer, $docPartRelsRight, $oldid, $newid)" /> |
|---|
| 287 | <a:blip r:link="{$newid}" /> |
|---|
| 288 | </xsl:when> |
|---|
| 289 | <xsl:otherwise> <!-- r:embed --> |
|---|
| 290 | <xsl:variable name="oldid" select="string(@del:embed)" /> |
|---|
| 291 | <xsl:variable name="newid" select="concat($oldid, 'R', $relsDiffIdentifier)" /> <!-- From RIGHT rels --> |
|---|
| 292 | <xsl:variable name="dummy" |
|---|
| 293 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 294 | $Differencer, $docPartRelsRight, $oldid, $newid)" /> |
|---|
| 295 | <a:blip r:embed="{$newid}" /> |
|---|
| 296 | </xsl:otherwise> |
|---|
| 297 | </xsl:choose> |
|---|
| 298 | </xsl:when> |
|---|
| 299 | <!-- cases: |
|---|
| 300 | (2) drawing, inserted in LHS |
|---|
| 301 | (3) normal drawing, present in LHS & RHS |
|---|
| 302 | --> |
|---|
| 303 | <xsl:otherwise> |
|---|
| 304 | <!-- Handle link|embed --> |
|---|
| 305 | |
|---|
| 306 | <xsl:variable name="logdummy" |
|---|
| 307 | select="java:org.docx4j.diff.Differencer.log('in a:blip, case 2 and 3')" /> |
|---|
| 308 | |
|---|
| 309 | <xsl:choose> |
|---|
| 310 | <xsl:when test="count(@r:link)=1"> |
|---|
| 311 | <xsl:variable name="oldid" select="string(@r:link)" /> |
|---|
| 312 | <xsl:variable name="newid" select="concat($oldid, 'L', $relsDiffIdentifier)" /> <!-- LEFT --> |
|---|
| 313 | <xsl:variable name="dummy" |
|---|
| 314 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 315 | $Differencer, $docPartRelsLeft, $oldid, $newid)" /> |
|---|
| 316 | <a:blip r:link="{$newid}" /> |
|---|
| 317 | </xsl:when> |
|---|
| 318 | <xsl:otherwise> <!-- r:embed --> |
|---|
| 319 | <xsl:variable name="oldid" select="string(@r:embed)" /> |
|---|
| 320 | <xsl:variable name="newid" select="concat($oldid, 'L', $relsDiffIdentifier)" /> <!-- LEFT --> |
|---|
| 321 | <xsl:variable name="dummy" |
|---|
| 322 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 323 | $Differencer, $docPartRelsLeft, $oldid, $newid)" /> |
|---|
| 324 | <a:blip r:embed="{$newid}" /> |
|---|
| 325 | </xsl:otherwise> |
|---|
| 326 | </xsl:choose> |
|---|
| 327 | </xsl:otherwise> |
|---|
| 328 | </xsl:choose> |
|---|
| 329 | |
|---|
| 330 | </xsl:template> |
|---|
| 331 | |
|---|
| 332 | <!-- Recover deleted drawing |
|---|
| 333 | |
|---|
| 334 | <w:drawing dfx:delete="true"> |
|---|
| 335 | <wp:inline dfx:delete="true"> |
|---|
| 336 | <wp:extent dfx:delete="true" del:cx="1533525" del:cy="1000125" /> |
|---|
| 337 | <wp:effectExtent dfx:delete="true" del:b="0" del:l="19050" del:r="9525" del:t="0" /> |
|---|
| 338 | <wp:docPr dfx:delete="true" del:id="2" del:name="Picture 1" /> |
|---|
| 339 | <wp:cNvGraphicFramePr dfx:delete="true"> |
|---|
| 340 | <a:graphicFrameLocks dfx:delete="true" del:noChangeAspect="true" /> |
|---|
| 341 | </wp:cNvGraphicFramePr> |
|---|
| 342 | <a:graphic dfx:delete="true"> |
|---|
| 343 | <a:graphicData dfx:delete="true" del:uri="http://schemas.openxmlformats.org/drawingml/2006/picture"> |
|---|
| 344 | <pic:pic dfx:delete="true"> |
|---|
| 345 | <pic:nvPicPr dfx:delete="true"> |
|---|
| 346 | <pic:cNvPr dfx:delete="true" del:id="0" del:name="Picture 1" /> |
|---|
| 347 | <pic:cNvPicPr dfx:delete="true"> |
|---|
| 348 | <a:picLocks dfx:delete="true" del:noChangeArrowheads="true" del:noChangeAspect="true" /> |
|---|
| 349 | </pic:cNvPicPr> |
|---|
| 350 | </pic:nvPicPr> |
|---|
| 351 | <pic:blipFill dfx:delete="true"> |
|---|
| 352 | <a:blip dfx:delete="true" del:link="rId4" /> |
|---|
| 353 | <a:srcRect dfx:delete="true" /> |
|---|
| 354 | <a:stretch dfx:delete="true"> |
|---|
| 355 | <a:fillRect dfx:delete="true" /> |
|---|
| 356 | </a:stretch> |
|---|
| 357 | </pic:blipFill> |
|---|
| 358 | <pic:spPr dfx:delete="true" del:bwMode="auto"> |
|---|
| 359 | <a:xfrm dfx:delete="true"> |
|---|
| 360 | <a:off dfx:delete="true" del:x="0" del:y="0" /> |
|---|
| 361 | <a:ext dfx:delete="true" del:cx="1533525" del:cy="1000125" /> |
|---|
| 362 | </a:xfrm> |
|---|
| 363 | <a:prstGeom dfx:delete="true" del:prst="rect"> |
|---|
| 364 | <a:avLst dfx:delete="true" /> |
|---|
| 365 | </a:prstGeom> |
|---|
| 366 | <a:noFill dfx:delete="true" /> |
|---|
| 367 | <a:ln dfx:delete="true" del:w="9525"> |
|---|
| 368 | <a:noFill dfx:delete="true" /> |
|---|
| 369 | <a:miter dfx:delete="true" del:lim="800000" /> |
|---|
| 370 | <a:headEnd dfx:delete="true" /> |
|---|
| 371 | <a:tailEnd dfx:delete="true" /> |
|---|
| 372 | </a:ln> |
|---|
| 373 | </pic:spPr> |
|---|
| 374 | </pic:pic> |
|---|
| 375 | </a:graphicData> |
|---|
| 376 | </a:graphic> |
|---|
| 377 | </wp:inline> |
|---|
| 378 | </w:drawing> |
|---|
| 379 | --> |
|---|
| 380 | |
|---|
| 381 | <xsl:template match="@dfx:delete[ancestor::w:drawing]" priority="5"/> |
|---|
| 382 | |
|---|
| 383 | <!-- all the deleted attributes are just in the default namespace --> |
|---|
| 384 | <xsl:template match="@del:*[ancestor::w:drawing]" priority="5"> |
|---|
| 385 | <xsl:attribute name="{local-name(.)}"> |
|---|
| 386 | <xsl:value-of select="." /> |
|---|
| 387 | </xsl:attribute> |
|---|
| 388 | </xsl:template> |
|---|
| 389 | |
|---|
| 390 | <xsl:template match="*[@dfx:delete and ancestor::w:drawing]" priority="4"> |
|---|
| 391 | <xsl:copy> |
|---|
| 392 | <xsl:apply-templates select="@*|node()"/> |
|---|
| 393 | </xsl:copy> |
|---|
| 394 | </xsl:template> |
|---|
| 395 | |
|---|
| 396 | <!-- Fix inserted drawing? No, nothing to do here, since @dfx:insert="true" |
|---|
| 397 | is removed above. |
|---|
| 398 | |
|---|
| 399 | <w:r dfx:insert="true"><w:rPr dfx:insert="true"><w:noProof dfx:insert="true" /> |
|---|
| 400 | </w:rPr> |
|---|
| 401 | <w:drawing dfx:insert="true"> |
|---|
| 402 | <wp:inline dfx:insert="true"> |
|---|
| 403 | <wp:extent dfx:insert="true" cx="457200" cy="400050" /> |
|---|
| 404 | <wp:effectExtent dfx:insert="true" b="0" l="19050" r="0" t="0" /> |
|---|
| 405 | <wp:docPr dfx:insert="true" id="5" name="Picture 3" /> |
|---|
| 406 | <wp:cNvGraphicFramePr dfx:insert="true"> |
|---|
| 407 | <a:graphicFrameLocks dfx:insert="true" noChangeAspect="true" /> |
|---|
| 408 | </wp:cNvGraphicFramePr> |
|---|
| 409 | <a:graphic dfx:insert="true"> |
|---|
| 410 | <a:graphicData dfx:insert="true" uri="http://schemas.openxmlformats.org/drawingml/2006/picture"> |
|---|
| 411 | <pic:pic dfx:insert="true"> |
|---|
| 412 | <pic:nvPicPr dfx:insert="true"> |
|---|
| 413 | <pic:cNvPr dfx:insert="true" id="0" name="Picture 3" /> |
|---|
| 414 | <pic:cNvPicPr dfx:insert="true"> |
|---|
| 415 | <a:picLocks dfx:insert="true" noChangeArrowheads="true" noChangeAspect="true" /> |
|---|
| 416 | </pic:cNvPicPr> |
|---|
| 417 | </pic:nvPicPr> |
|---|
| 418 | <pic:blipFill dfx:insert="true"> |
|---|
| 419 | <a:blip dfx:insert="true" r:link="rId6" /> |
|---|
| 420 | <a:srcRect dfx:insert="true" /> |
|---|
| 421 | <a:stretch dfx:insert="true"> |
|---|
| 422 | <a:fillRect dfx:insert="true" /> |
|---|
| 423 | </a:stretch> |
|---|
| 424 | </pic:blipFill> |
|---|
| 425 | <pic:spPr dfx:insert="true" bwMode="auto"> |
|---|
| 426 | <a:xfrm dfx:insert="true"> |
|---|
| 427 | <a:off dfx:insert="true" x="0" y="0" /> |
|---|
| 428 | <a:ext dfx:insert="true" cx="457200" cy="400050" /> |
|---|
| 429 | </a:xfrm> |
|---|
| 430 | <a:prstGeom dfx:insert="true" prst="rect"> |
|---|
| 431 | <a:avLst dfx:insert="true" /> |
|---|
| 432 | </a:prstGeom> |
|---|
| 433 | <a:noFill dfx:insert="true" /> |
|---|
| 434 | <a:ln dfx:insert="true" w="9525"> |
|---|
| 435 | <a:noFill dfx:insert="true" /> |
|---|
| 436 | <a:miter dfx:insert="true" lim="800000" /> |
|---|
| 437 | <a:headEnd dfx:insert="true" /> |
|---|
| 438 | <a:tailEnd dfx:insert="true" /> |
|---|
| 439 | </a:ln> |
|---|
| 440 | </pic:spPr> |
|---|
| 441 | </pic:pic> |
|---|
| 442 | </a:graphicData> |
|---|
| 443 | </a:graphic> |
|---|
| 444 | </wp:inline> |
|---|
| 445 | </w:drawing> |
|---|
| 446 | </w:r> |
|---|
| 447 | |
|---|
| 448 | --> |
|---|
| 449 | |
|---|
| 450 | <!-- w:hyperlink @r:id |
|---|
| 451 | |
|---|
| 452 | <w:hyperlink dfx:insert="true" r:id="rId5" w:history="true"> |
|---|
| 453 | <w:r> |
|---|
| 454 | <w:rPr dfx:insert="true"><w:rStyle dfx:insert="true" w:val="Hyperlink" /></w:rPr> |
|---|
| 455 | <w:t> |
|---|
| 456 | <ins>http://slashdot.org</ins> |
|---|
| 457 | <del>3</del> |
|---|
| 458 | </w:t> |
|---|
| 459 | </w:r> |
|---|
| 460 | </w:hyperlink> |
|---|
| 461 | |
|---|
| 462 | Word 2007 tracks the insertion/deletion of hyperlinks using |
|---|
| 463 | w:ins and w:del around the corresponding fields. |
|---|
| 464 | |
|---|
| 465 | We could replicate that, I guess. |
|---|
| 466 | |
|---|
| 467 | But for now, *we don't track the hyperlink itself*; just the text inside it. |
|---|
| 468 | |
|---|
| 469 | |
|---|
| 470 | --> |
|---|
| 471 | <xsl:template match="w:hyperlink" priority="5"> |
|---|
| 472 | |
|---|
| 473 | <xsl:choose> |
|---|
| 474 | <xsl:when test="@dfx:delete='true'"> |
|---|
| 475 | <xsl:variable name="id" |
|---|
| 476 | select="java:org.docx4j.diff.Differencer.getId()" /> |
|---|
| 477 | |
|---|
| 478 | <xsl:variable name="oldid" select="string(@del:id)" /> |
|---|
| 479 | <xsl:variable name="newid" select="concat($oldid, 'R', $relsDiffIdentifier)" /> <!-- From RIGHT rels --> |
|---|
| 480 | <xsl:variable name="dummy" |
|---|
| 481 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 482 | $Differencer, $docPartRelsRight, $oldid, $newid)" /> |
|---|
| 483 | <w:hyperlink r:id="{$newid}"> |
|---|
| 484 | <xsl:apply-templates select="@*|node()"/> |
|---|
| 485 | </w:hyperlink> |
|---|
| 486 | </xsl:when> |
|---|
| 487 | <xsl:when test="@dfx:insert='true'"> |
|---|
| 488 | <xsl:variable name="id" |
|---|
| 489 | select="java:org.docx4j.diff.Differencer.getId()" /> |
|---|
| 490 | <xsl:variable name="oldid" select="string(@r:id)" /> |
|---|
| 491 | <xsl:variable name="newid" select="concat($oldid, 'L', $relsDiffIdentifier)" /> <!-- LEFT --> |
|---|
| 492 | <xsl:variable name="dummy" |
|---|
| 493 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 494 | $Differencer, $docPartRelsLeft, $oldid, $newid)" /> |
|---|
| 495 | <w:hyperlink r:id="{$newid}"> |
|---|
| 496 | <xsl:apply-templates select="@*|node()"/> |
|---|
| 497 | </w:hyperlink> |
|---|
| 498 | </xsl:when> |
|---|
| 499 | <xsl:otherwise> |
|---|
| 500 | <xsl:variable name="oldid" select="string(@r:id)" /> |
|---|
| 501 | <xsl:variable name="newid" select="concat($oldid, 'L', $relsDiffIdentifier)" /> <!-- LEFT --> |
|---|
| 502 | <xsl:variable name="dummy" |
|---|
| 503 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 504 | $Differencer, $docPartRelsLeft, $oldid, $newid)" /> |
|---|
| 505 | <w:hyperlink r:id="{$newid}"> |
|---|
| 506 | <xsl:apply-templates select="@*|node()"/> |
|---|
| 507 | </w:hyperlink> |
|---|
| 508 | </xsl:otherwise> |
|---|
| 509 | </xsl:choose> |
|---|
| 510 | |
|---|
| 511 | </xsl:template> |
|---|
| 512 | |
|---|
| 513 | <!-- |
|---|
| 514 | TODO |
|---|
| 515 | w:object/v:imagedata |
|---|
| 516 | |
|---|
| 517 | w:object/o:OLEObject |
|---|
| 518 | |
|---|
| 519 | --> |
|---|
| 520 | |
|---|
| 521 | <!-- comments, footnotes, endnotes are simply stripped. |
|---|
| 522 | Handling these properly requires composing new parts, |
|---|
| 523 | for which an extension function similar to |
|---|
| 524 | registerRelationship would be required. |
|---|
| 525 | |
|---|
| 526 | Quite feasible, but a TODO. --> |
|---|
| 527 | <xsl:template match="w:commentReference | w:commentRangeStart | w:commentRangeEnd" /> |
|---|
| 528 | |
|---|
| 529 | <xsl:template match="w:footnoteReference | w:endnoteReference" /> |
|---|
| 530 | |
|---|
| 531 | |
|---|
| 532 | |
|---|
| 533 | <xsl:template match="w:tab[parent::w:r]"> <!-- so we don't match tab in properties --> |
|---|
| 534 | |
|---|
| 535 | <w:r> |
|---|
| 536 | <xsl:apply-templates select="../w:rPr" mode="omitDeletions"/> |
|---|
| 537 | <w:tab/> |
|---|
| 538 | </w:r> |
|---|
| 539 | |
|---|
| 540 | </xsl:template> |
|---|
| 541 | |
|---|
| 542 | |
|---|
| 543 | <xsl:template match="ins"> |
|---|
| 544 | |
|---|
| 545 | <xsl:variable name="id" |
|---|
| 546 | select="java:org.docx4j.diff.Differencer.getId()" /> |
|---|
| 547 | |
|---|
| 548 | |
|---|
| 549 | <w:ins w:id="{$id}" w:author="{$author}" w:date="{$date}"> <!-- w:date is optional --> |
|---|
| 550 | |
|---|
| 551 | <w:r> |
|---|
| 552 | <xsl:apply-templates select="../../w:rPr" mode="omitDeletions"/> |
|---|
| 553 | <w:t xml:space="preserve"><xsl:value-of select="."/></w:t> |
|---|
| 554 | </w:r> |
|---|
| 555 | </w:ins> |
|---|
| 556 | |
|---|
| 557 | </xsl:template> |
|---|
| 558 | |
|---|
| 559 | <xsl:template match="del"> |
|---|
| 560 | |
|---|
| 561 | <xsl:variable name="id" |
|---|
| 562 | select="java:org.docx4j.diff.Differencer.getId()" /> |
|---|
| 563 | |
|---|
| 564 | |
|---|
| 565 | <w:del w:id="{$id}" w:author="{$author}" w:date="{$date}"> <!-- w:date is optional --> |
|---|
| 566 | |
|---|
| 567 | <w:r> |
|---|
| 568 | <xsl:apply-templates select="../../w:rPr"/> |
|---|
| 569 | <w:delText><xsl:value-of select="."/></w:delText> |
|---|
| 570 | </w:r> |
|---|
| 571 | </w:del> |
|---|
| 572 | |
|---|
| 573 | </xsl:template> |
|---|
| 574 | |
|---|
| 575 | <xsl:template match="text()[not(ancestor::wp:*)]"> |
|---|
| 576 | |
|---|
| 577 | <w:r> |
|---|
| 578 | <xsl:apply-templates select="../../w:rPr" mode="omitDeletions"/> |
|---|
| 579 | <w:t xml:space="preserve"><xsl:value-of select="."/></w:t> |
|---|
| 580 | </w:r> |
|---|
| 581 | |
|---|
| 582 | </xsl:template> |
|---|
| 583 | |
|---|
| 584 | <!-- special case where diffx picks up a delete and insert as changes |
|---|
| 585 | to a single w:drawing |
|---|
| 586 | |
|---|
| 587 | A new w:drawing inserted next to an existing w:drawing seems to |
|---|
| 588 | confuse diffx, leading it to produce something which |
|---|
| 589 | includes: |
|---|
| 590 | |
|---|
| 591 | |
|---|
| 592 | <a:prstGeom dfx:insert="true" |
|---|
| 593 | prst="rect"> |
|---|
| 594 | <a:avLst dfx:insert="true" /> |
|---|
| 595 | </a:prstGeom> |
|---|
| 596 | <a:noFill dfx:insert="true" /> |
|---|
| 597 | <a:ln dfx:insert="true" w="9525"> |
|---|
| 598 | <a:noFill dfx:insert="true" /> |
|---|
| 599 | <a:miter dfx:insert="true" |
|---|
| 600 | lim="800000" /> |
|---|
| 601 | <a:headEnd dfx:insert="true" /> |
|---|
| 602 | <a:tailEnd dfx:insert="true" /> |
|---|
| 603 | </a:ln> |
|---|
| 604 | |
|---|
| 605 | |
|---|
| 606 | <a:prstGeom dfx:delete="true" |
|---|
| 607 | del:prst="rect"> |
|---|
| 608 | <a:avLst dfx:delete="true" /> |
|---|
| 609 | </a:prstGeom> |
|---|
| 610 | <a:noFill dfx:delete="true" /> |
|---|
| 611 | <a:ln dfx:delete="true" |
|---|
| 612 | del:w="9525"> |
|---|
| 613 | <a:noFill dfx:delete="true" /> |
|---|
| 614 | <a:miter dfx:delete="true" |
|---|
| 615 | del:lim="800000" /> |
|---|
| 616 | <a:headEnd dfx:delete="true" /> |
|---|
| 617 | <a:tailEnd dfx:delete="true" /> |
|---|
| 618 | </a:ln> |
|---|
| 619 | |
|---|
| 620 | WORKAROUND: In an effort to avoid using this template on something which |
|---|
| 621 | includes that, instead of |
|---|
| 622 | |
|---|
| 623 | match="w:drawing[not(@dfx:delete='true') and not(@dfx:insert='true') and |
|---|
| 624 | (descendant::*/@del:* or descendant::*/@dfx:*)] " |
|---|
| 625 | |
|---|
| 626 | require descendant::wp:docPr to have @del:*. |
|---|
| 627 | |
|---|
| 628 | NB also, there is a strange problem in which templates of mode deletedimage, |
|---|
| 629 | insertedimage don't seem to be doing the right thing with |
|---|
| 630 | attributes if @dfx:insert="true" or @dfx:delete="true" is true??? |
|---|
| 631 | The WORKAROUND hides this... |
|---|
| 632 | |
|---|
| 633 | |
|---|
| 634 | --> |
|---|
| 635 | <xsl:template match="w:drawing[not(@dfx:delete='true') and not(@dfx:insert='true') and |
|---|
| 636 | (descendant::wp:docPr/@del:*)] " priority="4"> |
|---|
| 637 | |
|---|
| 638 | <xsl:variable name="logdummy" |
|---|
| 639 | select="java:org.docx4j.diff.Differencer.log('Special case .. bifurcating w:drawing diff')" /> |
|---|
| 640 | |
|---|
| 641 | <xsl:variable name="id" |
|---|
| 642 | select="java:org.docx4j.diff.Differencer.getId()" /> |
|---|
| 643 | <!-- a copy of it deleted --> |
|---|
| 644 | <w:del w:id="{$id}" w:author="{$author}" w:date="{$date}"> <!-- w:date is optional --> |
|---|
| 645 | <w:r> |
|---|
| 646 | <xsl:copy> |
|---|
| 647 | <xsl:apply-templates select="node()" mode="deletedimage"/> <!-- drop @ --> |
|---|
| 648 | </xsl:copy> |
|---|
| 649 | </w:r> |
|---|
| 650 | </w:del> |
|---|
| 651 | |
|---|
| 652 | <!-- a copy of it inserted --> |
|---|
| 653 | <xsl:variable name="id2" |
|---|
| 654 | select="java:org.docx4j.diff.Differencer.getId()" /> |
|---|
| 655 | <w:ins w:id="{$id2}" w:author="{$author}" w:date="{$date}"> <!-- w:date is optional --> |
|---|
| 656 | <w:r> |
|---|
| 657 | <xsl:copy> |
|---|
| 658 | <xsl:apply-templates select="node()" mode="insertedimage" /> <!-- drop @ --> |
|---|
| 659 | </xsl:copy> |
|---|
| 660 | </w:r> |
|---|
| 661 | </w:ins> |
|---|
| 662 | |
|---|
| 663 | </xsl:template> |
|---|
| 664 | |
|---|
| 665 | <xsl:template match="@*|node()" mode="deletedimage"> |
|---|
| 666 | <xsl:copy> |
|---|
| 667 | <xsl:apply-templates select="@*|node()" mode="deletedimage"/> |
|---|
| 668 | </xsl:copy> |
|---|
| 669 | </xsl:template> |
|---|
| 670 | |
|---|
| 671 | <!-- WORKAROUND 2 .. this is currently untested. To test it, |
|---|
| 672 | you have to disable Workaround 1, then test on a document |
|---|
| 673 | in which a new image is inserted next to an existing one. --> |
|---|
| 674 | |
|---|
| 675 | <!-- If there is an unexpected mixture of delete and insert, |
|---|
| 676 | in deletedimage mode, lets try keeping the deleted bit |
|---|
| 677 | (as opposed to the inserted bit?) --> |
|---|
| 678 | <xsl:template match="@dfx:delete" priority="5" mode="deletedimage"/> |
|---|
| 679 | <xsl:template match="@del:*" priority="5" mode="deletedimage"> |
|---|
| 680 | <xsl:attribute name="{local-name(.)}"> |
|---|
| 681 | <xsl:value-of select="." /> |
|---|
| 682 | </xsl:attribute> |
|---|
| 683 | </xsl:template> |
|---|
| 684 | <xsl:template match="*[@dfx:insert]" priority="5" mode="deletedimage" /> |
|---|
| 685 | |
|---|
| 686 | <!-- If there is an unexpected mixture of delete and insert, |
|---|
| 687 | in insertedimage mode, lets try keeping the inserted bit |
|---|
| 688 | (as opposed to the deleted bit?) --> |
|---|
| 689 | <xsl:template match="@dfx:insert" priority="5" mode="insertedimage"/> |
|---|
| 690 | <xsl:template match="*[@dfx:delete]" priority="5" mode="insertedimage" /> |
|---|
| 691 | |
|---|
| 692 | <!-- end WORKAROUND 2 .. this is untested --> |
|---|
| 693 | |
|---|
| 694 | |
|---|
| 695 | <xsl:template match="@*|node()" mode="insertedimage"> |
|---|
| 696 | <xsl:copy> |
|---|
| 697 | <xsl:apply-templates select="@*|node()" mode="insertedimage"/> |
|---|
| 698 | </xsl:copy> |
|---|
| 699 | </xsl:template> |
|---|
| 700 | |
|---|
| 701 | <xsl:template match="wp:extent|a:ext" mode="deletedimage"> |
|---|
| 702 | |
|---|
| 703 | <xsl:variable name="cx"> |
|---|
| 704 | <xsl:choose> |
|---|
| 705 | <xsl:when test="@del:cx"> |
|---|
| 706 | <xsl:value-of select="string(@del:cx)"/> |
|---|
| 707 | </xsl:when> |
|---|
| 708 | <xsl:otherwise> |
|---|
| 709 | <xsl:value-of select="string(@cx)"/> |
|---|
| 710 | </xsl:otherwise> |
|---|
| 711 | </xsl:choose> |
|---|
| 712 | </xsl:variable> |
|---|
| 713 | |
|---|
| 714 | <xsl:variable name="cy"> |
|---|
| 715 | <xsl:choose> |
|---|
| 716 | <xsl:when test="@del:cy"> |
|---|
| 717 | <xsl:value-of select="string(@del:cy)"/> |
|---|
| 718 | </xsl:when> |
|---|
| 719 | <xsl:otherwise> |
|---|
| 720 | <xsl:value-of select="string(@cy)"/> |
|---|
| 721 | </xsl:otherwise> |
|---|
| 722 | </xsl:choose> |
|---|
| 723 | </xsl:variable> |
|---|
| 724 | |
|---|
| 725 | <xsl:choose> |
|---|
| 726 | <xsl:when test="self::wp:extent"> |
|---|
| 727 | <wp:extent cx="{$cx}" cy="{$cy}" /> |
|---|
| 728 | </xsl:when> |
|---|
| 729 | <xsl:when test="self::a:ext"> |
|---|
| 730 | <a:ext cx="{$cx}" cy="{$cy}" /> |
|---|
| 731 | </xsl:when> |
|---|
| 732 | </xsl:choose> |
|---|
| 733 | |
|---|
| 734 | </xsl:template> |
|---|
| 735 | |
|---|
| 736 | <!-- |
|---|
| 737 | |
|---|
| 738 | <wp:docPr id="3" name="Picture 3" del:id="1" del:name="Picture 1" /> |
|---|
| 739 | |
|---|
| 740 | <pic:cNvPr id="0" name="Picture 3" del:name="Picture 1" /> |
|---|
| 741 | |
|---|
| 742 | --> |
|---|
| 743 | <xsl:template match="wp:docPr|pic:cNvPr" mode="deletedimage"> |
|---|
| 744 | |
|---|
| 745 | <xsl:variable name="id"> |
|---|
| 746 | <xsl:choose> |
|---|
| 747 | <xsl:when test="@del:id"> |
|---|
| 748 | <xsl:value-of select="string(@del:id)"/> |
|---|
| 749 | </xsl:when> |
|---|
| 750 | <xsl:otherwise> |
|---|
| 751 | <xsl:value-of select="string(@id)"/> |
|---|
| 752 | </xsl:otherwise> |
|---|
| 753 | </xsl:choose> |
|---|
| 754 | </xsl:variable> |
|---|
| 755 | |
|---|
| 756 | <xsl:variable name="name"> |
|---|
| 757 | <xsl:choose> |
|---|
| 758 | <xsl:when test="@del:name"> |
|---|
| 759 | <xsl:value-of select="string(@del:name)"/> |
|---|
| 760 | </xsl:when> |
|---|
| 761 | <xsl:otherwise> |
|---|
| 762 | <xsl:value-of select="string(@name)"/> |
|---|
| 763 | </xsl:otherwise> |
|---|
| 764 | </xsl:choose> |
|---|
| 765 | </xsl:variable> |
|---|
| 766 | |
|---|
| 767 | <xsl:choose> |
|---|
| 768 | <xsl:when test="self::wp:docPr"> |
|---|
| 769 | <wp:docPr id="{$id}" name="{$name}" /> |
|---|
| 770 | </xsl:when> |
|---|
| 771 | <xsl:when test="self::pic:cNvPr"> |
|---|
| 772 | <pic:cNvPr id="{$id}" name="{$name}" /> |
|---|
| 773 | </xsl:when> |
|---|
| 774 | </xsl:choose> |
|---|
| 775 | |
|---|
| 776 | </xsl:template> |
|---|
| 777 | |
|---|
| 778 | |
|---|
| 779 | <!-- xsl:template match="wp:extent" mode="insertedimage" |
|---|
| 780 | |
|---|
| 781 | nothing special needed for this |
|---|
| 782 | |
|---|
| 783 | --> |
|---|
| 784 | |
|---|
| 785 | <!-- TODO: consolidate the following 2 templates to call a single named template, |
|---|
| 786 | and pass in parameters LorR, and $docpartRels --> |
|---|
| 787 | |
|---|
| 788 | <xsl:template match="a:blip" mode="deletedimage"> |
|---|
| 789 | |
|---|
| 790 | <xsl:choose> |
|---|
| 791 | <xsl:when test="count(@del:link)=1"> |
|---|
| 792 | <xsl:variable name="oldid" select="string(@del:link)" /> |
|---|
| 793 | <xsl:variable name="newid" select="concat($oldid, 'R', $relsDiffIdentifier)" /> <!-- From RIGHT rels --> |
|---|
| 794 | <xsl:variable name="dummy" |
|---|
| 795 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 796 | $Differencer, $docPartRelsRight, $oldid, $newid)" /> |
|---|
| 797 | <a:blip r:link="{$newid}" /> |
|---|
| 798 | </xsl:when> |
|---|
| 799 | <xsl:when test="count(@del:link)=1"> |
|---|
| 800 | <xsl:variable name="oldid" select="string(@del:embed)" /> |
|---|
| 801 | <xsl:variable name="newid" select="concat($oldid, 'R', $relsDiffIdentifier)" /> <!-- From RIGHT rels --> |
|---|
| 802 | <xsl:variable name="dummy" |
|---|
| 803 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 804 | $Differencer, $docPartRelsRight, $oldid, $newid)" /> |
|---|
| 805 | <a:blip r:embed="{$newid}" /> |
|---|
| 806 | </xsl:when> |
|---|
| 807 | <xsl:when test="count(@r:link)=1"> |
|---|
| 808 | <xsl:variable name="oldid" select="string(@r:link)" /> |
|---|
| 809 | <xsl:variable name="newid" select="concat($oldid, 'R', $relsDiffIdentifier)" /> <!-- From RIGHT rels --> |
|---|
| 810 | <xsl:variable name="dummy" |
|---|
| 811 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 812 | $Differencer, $docPartRelsRight, $oldid, $newid)" /> |
|---|
| 813 | <a:blip r:link="{$newid}" /> |
|---|
| 814 | </xsl:when> |
|---|
| 815 | <xsl:when test="count(@r:embed)=1"> |
|---|
| 816 | <xsl:variable name="oldid" select="string(@r:embed)" /> |
|---|
| 817 | <xsl:variable name="newid" select="concat($oldid, 'R', $relsDiffIdentifier)" /> <!-- From RIGHT rels --> |
|---|
| 818 | <xsl:variable name="dummy" |
|---|
| 819 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 820 | $Differencer, $docPartRelsRight, $oldid, $newid)" /> |
|---|
| 821 | <a:blip r:embed="{$newid}" /> |
|---|
| 822 | </xsl:when> |
|---|
| 823 | <xsl:otherwise> <!-- unexpected --> |
|---|
| 824 | <xsl:variable name="logdummy" |
|---|
| 825 | select="java:org.docx4j.diff.Differencer.log('UNEXPECTED - how to handle this a:blip?')" /> |
|---|
| 826 | |
|---|
| 827 | <xsl:copy> |
|---|
| 828 | <xsl:apply-templates select="@*|node()" /> <!-- revert to normal mode --> |
|---|
| 829 | </xsl:copy> |
|---|
| 830 | </xsl:otherwise> |
|---|
| 831 | </xsl:choose> |
|---|
| 832 | |
|---|
| 833 | </xsl:template> |
|---|
| 834 | |
|---|
| 835 | <xsl:template match="a:blip" mode="insertedimage"> |
|---|
| 836 | |
|---|
| 837 | <xsl:choose> |
|---|
| 838 | <xsl:when test="count(@del:link)=1"> |
|---|
| 839 | <xsl:variable name="oldid" select="string(@del:link)" /> |
|---|
| 840 | <xsl:variable name="newid" select="concat($oldid, 'L', $relsDiffIdentifier)" /> <!-- From RIGHT rels --> |
|---|
| 841 | <xsl:variable name="dummy" |
|---|
| 842 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 843 | $Differencer, $docPartRelsLeft, $oldid, $newid)" /> |
|---|
| 844 | <a:blip r:link="{$newid}" /> |
|---|
| 845 | </xsl:when> |
|---|
| 846 | <xsl:when test="count(@del:link)=1"> |
|---|
| 847 | <xsl:variable name="oldid" select="string(@del:embed)" /> |
|---|
| 848 | <xsl:variable name="newid" select="concat($oldid, 'L', $relsDiffIdentifier)" /> <!-- From RIGHT rels --> |
|---|
| 849 | <xsl:variable name="dummy" |
|---|
| 850 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 851 | $Differencer, $docPartRelsLeft, $oldid, $newid)" /> |
|---|
| 852 | <a:blip r:embed="{$newid}" /> |
|---|
| 853 | </xsl:when> |
|---|
| 854 | <xsl:when test="count(@r:link)=1"> |
|---|
| 855 | <xsl:variable name="oldid" select="string(@r:link)" /> |
|---|
| 856 | <xsl:variable name="newid" select="concat($oldid, 'L', $relsDiffIdentifier)" /> <!-- From RIGHT rels --> |
|---|
| 857 | <xsl:variable name="dummy" |
|---|
| 858 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 859 | $Differencer, $docPartRelsLeft, $oldid, $newid)" /> |
|---|
| 860 | <a:blip r:link="{$newid}" /> |
|---|
| 861 | </xsl:when> |
|---|
| 862 | <xsl:when test="count(@r:embed)=1"> |
|---|
| 863 | <xsl:variable name="oldid" select="string(@r:embed)" /> |
|---|
| 864 | <xsl:variable name="newid" select="concat($oldid, 'L', $relsDiffIdentifier)" /> <!-- From RIGHT rels --> |
|---|
| 865 | <xsl:variable name="dummy" |
|---|
| 866 | select="java:org.docx4j.diff.Differencer.registerRelationship( |
|---|
| 867 | $Differencer, $docPartRelsLeft, $oldid, $newid)" /> |
|---|
| 868 | <a:blip r:embed="{$newid}" /> |
|---|
| 869 | </xsl:when> |
|---|
| 870 | <xsl:otherwise> <!-- unexpected --> |
|---|
| 871 | <xsl:variable name="logdummy" |
|---|
| 872 | select="java:org.docx4j.diff.Differencer.log('UNEXPECTED - how to handle this a:blip?')" /> |
|---|
| 873 | |
|---|
| 874 | <xsl:copy> |
|---|
| 875 | <xsl:apply-templates select="@*|node()" /> <!-- revert to normal mode --> |
|---|
| 876 | </xsl:copy> |
|---|
| 877 | </xsl:otherwise> |
|---|
| 878 | </xsl:choose> |
|---|
| 879 | |
|---|
| 880 | |
|---|
| 881 | </xsl:template> |
|---|
| 882 | |
|---|
| 883 | |
|---|
| 884 | |
|---|
| 885 | </xsl:stylesheet> |
|---|