Show
Ignore:
Timestamp:
26.03.2012 17:39:57 (8 years ago)
Author:
ak19
Message:

For ease of import and export in Excel, these scripts no longer generates a spreadsheet .txt file of comma separated values but of tab separated values.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/gti/gti-xml-to-spreadsheet.xsl

    r25287 r25288  
    88       GS2/bin/script> perl -S gti.pl get-first-n-chunks-requiring-work mi coredm 1000 > ../../macros/maori/mi-core.xml 
    99 
    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).  
    1111       NOTE: Make sure the output is a *.txt file if you wish to open it in Excel without losing the unicode  
    1212       (when opened with .csv extension, the unicode is not preserved). 
     
    1414       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 
    1515 
    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. 
    1819 
    1920       - A wizard will appear, allowing users to open this .txt file as a proper spreadsheet. 
     
    2223       b. in the drop down on the right, select unicode (UTF-8 or UTF-16) 
    2324       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. 
    2526        
    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> 
    3036 
    3137    --> 
     
    3440 
    3541  <xsl:template match="GTIResponse"> 
    36     <xsl:text>Key&#44;Source&#44;Target</xsl:text><!--column headings--> 
     42    <xsl:text>Key&#09;Source&#09;Target</xsl:text><!--column headings separated by tabs--> 
    3743    <xsl:text>&#10;</xsl:text> <!--newline-->   
    3844    <xsl:apply-templates select="ChunksRequiringUpdating"/> 
     
    5561  <xsl:template match="Chunk"> 
    5662    <xsl:value-of select="@key"/> 
    57     <xsl:text>&#44;</xsl:text> 
     63    <xsl:text>&#09;</xsl:text> 
    5864    <xsl:for-each select="SourceFileText"> 
    5965      <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll(., "\n", "&amp;#10;")'/> 
     66      <!--<xsl:variable name="tempText2" select="java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, '&#92;&#34;', '&amp;#34;')"/>--> <!-- escape (backslash-)quote with entity for quote--> 
     67      <!--<xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, ",", "&amp;#44;")'/>--> <!--Escape commas in text, as they are not CSV delimiters--> 
    6068      <xsl:value-of select='$escapedText' disable-output-escaping="yes"/> 
    6169    </xsl:for-each> 
    6270    <!--<xsl:value-of select="SourceFileText"/>--> 
    63     <xsl:text>&#44;</xsl:text> 
     71    <xsl:text>&#09;</xsl:text> 
    6472    <xsl:for-each select="TargetFileText"> 
    6573      <xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll(., "\n", "&amp;#10;")'/> 
     74      <!--<xsl:variable name="tempText2" select="java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, '&#92;&#34;', '&amp;#34;')"/>--> <!-- escape (backslash-)quote with entity for quote--> 
     75      <!--<xsl:variable name="escapedText" select='java:org.nzdl.gsdl.ApplyXSLT.replaceAll($tempText1, ",", "&amp;#44;")'/>--> <!--Escape commas in text, as they are not CSV delimiters--> 
    6676      <xsl:value-of select='$escapedText' disable-output-escaping="yes"/> 
    6777    </xsl:for-each>