don asked me to run some samples through xliffroundtrip tool grabbed the dita open toolkit samples...

17
Don asked me to run some samples through xliffRoundTrip tool • Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from http://dita-ot.sourceforge.net • Ran them through the xliffRoundTrip tool http://sourceforge.net/projects/ xliffroundtrip/

Upload: alfredo-wallwork

Post on 28-Mar-2015

228 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Don asked me to run some samples through xliffRoundTrip tool

• Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

http://dita-ot.sourceforge.net

• Ran them through the xliffRoundTrip tool

http://sourceforge.net/projects/xliffroundtrip/

Page 2: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Started with one of Don’s samples

<!-- (C) Copyright IBM Corporation 2001, 2005. All Rights Reserved.

*--><!DOCTYPE concept PUBLIC "-//OASIS//DTD

DITA Concept//EN" "../../dtd/concept.dtd"><concept id="conceptconcept" xml:lang="en-us"><title>Garage Concepts</title><conbody><p>A well-stocked garage can be the

envy of the neighborhood.</p></conbody></concept>

Page 3: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Ran the xliffRoundTrip tool: XML to XLIFF step

Page 4: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Created a perfectly valid XLIFF File

<xliff xmlns="urn:oasis:names:tc:xliff:document:1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xmrk="http://www.xmarker.com" version="1.1" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.1 xliff-1.1.xsd">

<file original="concept" source-language="en" datatype="plaintext" xmrk:id="conceptconcept"><body><trans-unit xmrk:ancs="1" id="title-x-mch1-N10006" resname="title"><source xmrk:ancs="1">Garage Concepts</source><target>Garage Concepts</target></trans-unit><group xmrk:ancs="1" resname="conbody"><group resname="conbody" xmrk:ancs="1" id="throw1-N10008"><trans-unit xmrk:ancs="2" id="p-x-mch1-N10009" resname="p"><source xmrk:ancs="2">A well-stocked garage can be the envy of the neighborhood.</source><target>A well-stocked garage can be the envy of the neighborhood.</target></trans-unit></group></group></body></file></xliff>

Page 5: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Did a quick and dirty translation<xliff xmlns="urn:oasis:names:tc:xliff:document:1.1"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xmrk="http://www.xmarker.com" version="1.1" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.1 xliff-1.1.xsd">

<file original="concept" source-language="en" datatype="plaintext" xmrk:id="conceptconcept"><body><trans-unit xmrk:ancs="1" id="title-x-mch1-N10006" resname="title"><source xmrk:ancs="1">Garage Concepts</source><target>Garage-Konzepte</target></trans-unit><group xmrk:ancs="1" resname="conbody"><group resname="conbody" xmrk:ancs="1" id="throw1-N10008"><trans-unit xmrk:ancs="2" id="p-x-mch1-N10009" resname="p"><source xmrk:ancs="2">A well-stocked garage can be the envy of the neighborhood.</source><target>Eine gut-auf Lagere Garage kann der Neid der Nachbarschaft sein.</target></trans-unit></group></group></body></file></xliff>

Page 6: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Did the XLIFF to XML step

Page 7: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Got a translated DITA file

<?xml version="1.0" encoding="utf-8"?><!-- (C) Copyright IBM Corporation 2001, 2005. All

Rights Reserved. *--><concept id="conceptconcept"><title>Garage-Konzepte</title><conbody><p>Eine gut-auf Lagere Garage kann der Neid der

Nachbarschaft sein.</p></conbody></concept>

Page 8: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Problem: lots of DITA files can be tedious to process, 1 by 1

Page 9: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Created a little command-line application; goes like this:

• Started with xliffRoundTrip Tool’s XSLTs• Noted that the sample has a map file

(hierarchy.ditamap)• (being shamefully inexperienced with DITA) . . .

I made a naive assumption that many DITA documents have some kind of map file

• Modified the XSLT to read the mapfile, and convert each of the referenced files to XLIFF

Page 10: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

You can try the sample application

Page 11: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Unzip the zip file; get this

Note: to output many-from-one, XSLT 2.0 was necessary. I included Saxon-B 8.7.1, which is officially hosted here:

http://saxon.sourceforge.net/#F8.7.1SA

Page 12: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Double click step1_D2X.bat• step1_D2X.bat interrogates the samples\

hierarchy.ditamap• Generates an XLIFF file (xliff_ized_DITA.xlf) which has

<file> elements for each file referenced in the hierarchy.ditamap

Page 13: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

xliff_ized_DITA.xlf

Page 14: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Double click step2_pseudo-xlate.bat

For demonstration purposes, hit the XLIFF file with a little pseudo translation XSLT

• step2_pseudo-xlate.bat “translates” the <target> elements in the xliff_ized_DITA.xlf XLIFF file, to create p_xlated_xliff_ized_DITA.xlf

Page 15: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

p_xlated_xliff_ized_DITA.xlf

Page 16: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from

Double click step3_X2D.bat• step3_X2D.bat transforms the

“translated” XLIFF file (p_xlated_xliff_ized_DITA.xlf) to translated DITA files

• It creates subdirectories for the translated files, and puts the DITA files in the appropriate subdirectory

Page 17: Don asked me to run some samples through xliffRoundTrip tool Grabbed the DITA Open Toolkit samples (DITA-OT1.2.2_bin.zip) from