source: trunk/docx4j/src/main/java/org/docx4j/diff/diffx2html.xslt @ 481

Revision 481, 3.4 KB checked in by jharrop, 4 years ago (diff)

Algorithm significantly updated.

Line 
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:ns2="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
7    xmlns:ns4="http://schemas.openxmlformats.org/schemaLibrary/2006/main"
8    xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
9        xmlns:java="http://xml.apache.org/xalan/java"   
10  xmlns:xml="http://www.w3.org/XML/1998/namespace"
11  xmlns:xalan="http://xml.apache.org/xalan"
12               
13  version="1.0" 
14        exclude-result-prefixes="java"> 
15 
16
17  <!--
18  *  Copyright 2007, Plutext Pty Ltd.
19  *
20  *  This file is part of plutext-client-word2007.
21
22  plutext-client-word2007 is free software: you can redistribute it and/or
23  modify it under the terms of version 3 of the GNU General Public License
24  as published by the Free Software Foundation.
25
26  plutext-client-word2007 is distributed in the hope that it will be
27  useful, but WITHOUT ANY WARRANTY; without even the implied warranty
28  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29  GNU General Public License for more details.
30
31  You should have received a copy of the GNU General Public License
32  along with plutext-client-word2007.  If not, see
33  <http://www.gnu.org/licenses/>.
34
35  -->
36
37  <xsl:output method="html" encoding="utf-8" omit-xml-declaration="no" 
38  indent="yes" xalan:indent-amount="4" />
39
40
41<!-- 
42
43        WARNING: this xslt exists solely to help in testing the diff
44        output, by allowing it to be viewed easily as HTML.
45
46        It is not intended for production.
47
48 -->
49
50<xsl:param name="author"/>
51
52
53  <xsl:template match="/ | @*|node()">
54    <xsl:copy>
55      <xsl:apply-templates select="@*|node()"/>
56    </xsl:copy>
57  </xsl:template>
58
59
60
61  <!-- Any element which has a dfx:delete attribute can be deleted.
62 
63       This is ok in pPr, since we don't bother to track those changes.
64       
65       But if it occurs on w:p, w:r, or w:t, we will need to do better.
66         -->
67  <xsl:template match="*[@dfx:delete='true' and parent::w:pPr] "/>
68
69  <xsl:template match="@del:val"/>
70
71
72  <xsl:template match="*[@dfx:insert='true']" >
73    <xsl:copy>
74      <xsl:apply-templates select="@*|node()"/>
75    </xsl:copy>
76  </xsl:template>
77 
78  <xsl:template match="@dfx:insert" />
79 
80
81  <xsl:template match="w:p">
82 
83        <p>
84      <xsl:apply-templates select="@*|node()"/>         
85        </p>
86 
87  </xsl:template>
88
89  <xsl:template match="w:r">
90
91     <xsl:apply-templates/>
92
93  </xsl:template>
94
95  <xsl:template match="w:t[@dfx:insert='true']" >
96
97    <span style="text-decoration: underline;color:red;"> 
98
99     <xsl:apply-templates/>
100
101        </span>
102           
103  </xsl:template>
104
105
106  <xsl:template match="ins">
107
108    <span style="text-decoration: underline;color:red;"> 
109
110          <xsl:value-of select="."/> <!-- assume this is just text in a diffx ins element-->
111
112        </span>
113           
114  </xsl:template>
115
116  <xsl:template match="del">
117
118    <span style="text-decoration: line-through;color:red;"> 
119
120          <xsl:value-of select="."/>
121         
122        </span>
123
124  </xsl:template>
125
126  <xsl:template match="w:t[@dfx:delete='true']" >
127
128    <span style="text-decoration: line-through;color:red;"> 
129
130     <xsl:apply-templates/>
131
132        </span>
133           
134  </xsl:template>
135
136
137</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.