Changeset 25288 for other-projects/gti/gti-xml-to-spreadsheet.xsl
- Timestamp:
- 2012-03-26T17:39:57+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/gti/gti-xml-to-spreadsheet.xsl
r25287 r25288 8 8 GS2/bin/script> perl -S gti.pl get-first-n-chunks-requiring-work mi coredm 1000 > ../../macros/maori/mi-core.xml 9 9 10 2. Apply this XSLT to that XML file to obtain a unicode text file containing comma-separated values (a spreadsheet).10 2. Apply this XSLT to that XML file to obtain a unicode text file containing tab-separated values (a spreadsheet). 11 11 NOTE: Make sure the output is a *.txt file if you wish to open it in Excel without losing the unicode 12 12 (when opened with .csv extension, the unicode is not preserved). … … 14 14 GS2/bin/script> java -cp /research/ak19/gs2-svn/bin/java/ApplyXSLT.jar org.nzdl.gsdl.ApplyXSLT -x ../../macros/maori/mi-core.xml -t ../script/gti-xml-to-spreadsheet.xsl > ../../maori/core-mi-spreadsheet.txt 15 15 16 3. Translators wishing to read this text file into Excel, need to first open Excel. Then go to File > Open, 17 and choose to open the unicode .txt file containing the comma-separated values. 16 3. Translators wishing to read this text file into Excel, need to first open Excel. 17 Then go to File > Open, set the filetypes drop-down to show All Files *.*, 18 and choose to open the unicode .txt file containing the tab-separated values. 18 19 19 20 - A wizard will appear, allowing users to open this .txt file as a proper spreadsheet. … … 22 23 b. in the drop down on the right, select unicode (UTF-8 or UTF-16) 23 24 c. Click next 24 In the second frame of the dialog, select " comma" as the delimiter. Click Finish to open the spreadsheet data.25 In the second frame of the dialog, select "tab" as the delimiter. Click Finish to open the spreadsheet data. 25 26 26 4. When translators have finished working on the file, they can save it simply as an Excel spreadsheet .xls file 27 (File > Save As > Excel 2003 spreadsheet) and mail it back to Greenstone. 28 Translators are advised against saving it as a .txt 2003 Excel spreadsheet, since it doesn't seem to preserve the 29 comma delimiters. 27 4. When translators have finished working on the file, save it as an Excel spreadsheet Unicode .txt file 28 (through File > Save As > Excel 2003 spreadsheet > choose Unicode .txt in the file types box) 29 and mail this text file back to Greenstone. 30 31 5. The file returned by the translator should first be processed with the new gti-process-google-spreadsheet.pl script: 32 GS2/bin/script>perl -S gti-process-google-spreadsheet.pl ~/Desktop/core-mi-xml2spreadsheet-out.txt > <language>-submission.xml 33 34 Then continue processing as usual 35 > cat <language>-submission.xml | perl -S gti.pl submit-translations <language-code> <module-name> <username> 30 36 31 37 --> … … 34 40 35 41 <xsl:template match="GTIResponse"> 36 <xsl:text>Key&# 44;Source,Target</xsl:text><!--column headings-->42 <xsl:text>Key	Source	Target</xsl:text><!--column headings separated by tabs--> 37 43 <xsl:text> </xsl:text> <!--newline--> 38 44 <xsl:apply-templates select="ChunksRequiringUpdating"/> … … 55 61 <xsl:template match="Chunk"> 56 62 <xsl:value-of select="@key"/> 57 <xsl:text>&# 44;</xsl:text>63 <xsl:text>	</xsl:text> 58 64 <xsl:for-each select="SourceFileText"> 59 65 <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll(., "\n", "&#10;")'/> 66 <!--<xsl:variable name="tempText2" select="java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, '\"', '&#34;')"/>--> <!-- escape (backslash-)quote with entity for quote--> 67 <!--<xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, ",", "&#44;")'/>--> <!--Escape commas in text, as they are not CSV delimiters--> 60 68 <xsl:value-of select='$escapedText' disable-output-escaping="yes"/> 61 69 </xsl:for-each> 62 70 <!--<xsl:value-of select="SourceFileText"/>--> 63 <xsl:text>&# 44;</xsl:text>71 <xsl:text>	</xsl:text> 64 72 <xsl:for-each select="TargetFileText"> 65 73 <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll(., "\n", "&#10;")'/> 74 <!--<xsl:variable name="tempText2" select="java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, '\"', '&#34;')"/>--> <!-- escape (backslash-)quote with entity for quote--> 75 <!--<xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, ",", "&#44;")'/>--> <!--Escape commas in text, as they are not CSV delimiters--> 66 76 <xsl:value-of select='$escapedText' disable-output-escaping="yes"/> 67 77 </xsl:for-each>
Note:
See TracChangeset
for help on using the changeset viewer.