root/other-projects/gti/gti-generate-excel-xml.xsl @ 24434

Revision 24434, 3.7 KB (checked in by ak19, 8 years ago)

Greenstone Translator Interface files for generating excel spreadsheet file. See internal wiki's GTI page.

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xslt/java" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
3
4  <xsl:output method="xml" encoding="UTF-8"/>
5
6  <xsl:template match="GTIResponse">
7    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
8          xmlns:o="urn:schemas-microsoft-com:office:office"
9          xmlns:x="urn:schemas-microsoft-com:office:excel"
10          xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
11          xmlns:html="http://www.w3.org/TR/REC-html40">
12      <DocumentProperties>
13        <Author>Greenstone Translator Interface</Author>
14    <LastAuthor>Greenstone Translator Interface</LastAuthor>
15    <Created>2003-05-05T01:30:36Z</Created>
16    <Company>New Zealand Digital Library Project</Company>
17    <Version>10.2625</Version>
18      </DocumentProperties>
19      <OfficeDocumentSettings>
20        <DownloadComponents/>
21    <LocationOfComponents HRef="blah"/>
22      </OfficeDocumentSettings>
23      <Styles>
24    <Style ss:ID="Default" ss:Name="Normal">
25      <Alignment ss:Vertical="Top"/>
26      <Borders/>
27      <Font/>
28      <Interior/>
29      <NumberFormat/>
30      <Protection/>
31    </Style>
32    <Style ss:ID="Heading">
33          <Font x:Family="Swiss" ss:Bold="1"/>
34        </Style>
35    <Style ss:ID="TextCell">
36      <Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
37      <Font ss:FontName="Arial Unicode MS"/>
38    </Style>
39      </Styles>
40      <Worksheet ss:Name="Greenstone Translation">
41    <Table>
42      <Column ss:Width="250" ss:Index="1" ss:AutoFitWidth="0"/>
43          <Column ss:Width="1000" ss:Index="2" ss:AutoFitWidth="1"/>
44      <Row>
45        <Cell ss:StyleID="Heading"><Data ss:Type="String">Key</Data></Cell>
46        <Cell ss:StyleID="Heading"><Data ss:Type="String">Text</Data></Cell>
47      </Row>
48      <xsl:apply-templates/>
49    </Table>
50      </Worksheet>
51    </Workbook>
52  </xsl:template>
53
54
55  <xsl:template match="ChunksRequiringTranslation">
56    <xsl:apply-templates>
57      <xsl:sort select="@key"/>
58    </xsl:apply-templates>
59  </xsl:template>
60
61
62  <xsl:template match="ChunksRequiringUpdating">
63    <xsl:apply-templates>
64      <xsl:sort select="@key"/>
65    </xsl:apply-templates>
66  </xsl:template>
67
68
69  <xsl:template match="Chunk">
70    <Row xmlns="urn:schemas-microsoft-com:office:spreadsheet"/>
71
72    <Row xmlns="urn:schemas-microsoft-com:office:spreadsheet">
73      <Cell>
74        <Data ss:Type="String">source::<xsl:value-of select="@key"/></Data>
75      </Cell>
76      <Cell ss:StyleID="TextCell">
77        <Data ss:Type="String">
78          <xsl:for-each select="SourceFileText">
79        <xsl:variable name="tempText1" select='java:ApplyXSLT.replaceAll(., "\n", "&amp;#10;&#10;")'/>
80        <xsl:variable name="tempText2" select='java:ApplyXSLT.replaceAll($tempText1, "&#60;", "&amp;lt;")'/>
81        <xsl:variable name="escapedText" select='java:ApplyXSLT.replaceAll($tempText2, "&#62;", "&amp;gt;")'/>
82        <xsl:value-of select='$escapedText' disable-output-escaping="yes"/>
83          </xsl:for-each>
84    </Data>
85      </Cell>
86    </Row>
87
88    <Row xmlns="urn:schemas-microsoft-com:office:spreadsheet">
89      <Cell>
90        <Data ss:Type="String">target::<xsl:value-of select="@key"/></Data>
91      </Cell>
92      <Cell ss:StyleID="TextCell">
93        <Data ss:Type="String">
94          <xsl:for-each select="TargetFileText">
95        <xsl:variable name="tempText1" select='java:ApplyXSLT.replaceAll(., "\n", "&amp;#10;&#10;")'/>
96        <xsl:variable name="tempText2" select='java:ApplyXSLT.replaceAll($tempText1, "&#60;", "&amp;lt;")'/>
97        <xsl:variable name="escapedText" select='java:ApplyXSLT.replaceAll($tempText2, "&#62;", "&amp;gt;")'/>
98        <xsl:value-of select='$escapedText' disable-output-escaping="yes"/>
99          </xsl:for-each>
100    </Data>
101      </Cell>
102    </Row>
103  </xsl:template>
104
105</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.