+ All Categories
Home > Technology > Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Date post: 12-May-2015
Category:
Upload: scriptorium-publishing
View: 1,583 times
Download: 2 times
Share this document with a friend
Description:
Workshop presentation from Intelligent Content 2012 in Pal
Popular Tags:
38
Down the Rabbit Hole: Getting Started with the DITA Open Toolkit Sarah O’Keefe Scriptorium Publishing Wednesday, February 22, 12
Transcript
Page 1: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Down the Rabbit Hole:Getting Started with the

DITA Open Toolkit

Sarah O’KeefeScriptorium Publishing

Wednesday, February 22, 12

Page 2: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Sarah O’Keefe

❖ Founder and president, Scriptorium Publishing

❖ Content strategy fortechnical communication

❖ Interested in collision ofcontent, publishing, andtechnology

Wednesday, February 22, 12

Page 3: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Overview

❖ Installing the DITA Open Toolkit

❖ Generating output

❖ Customizing output

Wednesday, February 22, 12

Page 4: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

flickr: themaninblueWednesday, February 22, 12

Page 5: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Installing the OT

❖ Download from dita-ot.sourceforge.net

❖ Use version 1.5.4 for today

❖ DITA-OT1.5.4_full_easy_install_bin.zip

❖ USB drives contain DITA-OT1.5.4, unzipped for your convenience

Wednesday, February 22, 12

Page 6: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Best practices

❖ Set up in top-level directory

❖ Do not use spaces in file names or directory names

❖ Use a stable build and not the development builds

Wednesday, February 22, 12

Page 7: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Remember the command line?flickr: johnhurn

Wednesday, February 22, 12

Page 8: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Testing your installation

❖ Open a command window

❖ Navigate to your DITA OT folder

❖ Run

❖ ./startcmd.sh (UNIX)

❖ startcmd.bat (Windows)

❖ ant -f build_demo.xml

Wednesday, February 22, 12

Page 9: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

$ cd /DITA-OT1.5.4$ ./startcmd.shDITA_HOME environment variable is empty or not set

You need to edit the startcmd.sh file.

Wednesday, February 22, 12

Page 10: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

#!/bin/sh# This file is part of the DITA Open Toolkit project hosted on # Sourceforge.net. See the accompanying license.txt file for # applicable licenses.# (c) Copyright IBM Corp. 2006 All Rights Reserved.

DITA_HOME="/DITA-OT1.5.4"

if [ "${DITA_HOME:+1}" != "1" ]; then echo "DITA_HOME environment variable is empty or not set"; exit 127;fi...

Add this line.SPACES MATTER!

Wednesday, February 22, 12

Page 11: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

$ ./startcmd.sh$ ant -f build_demo.xmlBuildfile: build_demo.xml

prompt.init:[....]prompt.output: [echo] [echo] output in the out directory [echo] [echo] Before rebuilding, please delete the output or the directory.

BUILD SUCCESSFULTotal time: 33 seconds$ “Your OT is installed

and working.”

Wednesday, February 22, 12

Page 12: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

It gets better.

flickr: wadem

(No, it doesn’t.)

Wednesday, February 22, 12

Page 13: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

flickr: cdemoGenerating output

Wednesday, February 22, 12

Page 14: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

ant -f build.xml    -Dargs.input=input-ditamap   -Doutput.dir=output-folder   -Dtranstype=transformation-type

ant -f build.xml -Dargs.input=C:/DITA-OT1.5.4/doc/userguide.ditamap -Doutput.dir=C:/out -Dtranstype=xhtml

Generating outputTheory

Example

Wednesday, February 22, 12

Page 15: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Customizing outputflickr: jpockele

Wednesday, February 22, 12

Page 16: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Best practice: Create a plugin

flickr: Robobobobo

Wednesday, February 22, 12

Page 17: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Creating a plugin

❖ Create a folder for the plugin

❖ Set up the plugin.xml and conductor.xml files

❖ Verify the installation with a tiny customization

Wednesday, February 22, 12

Page 18: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Creating a folder for the plugin❖ Plugins go in the OT’s plugins directory.

❖ Naming convention is:

❖ <your domain>.<your plugin>

❖ com.scriptorium.myhtml

Wednesday, February 22, 12

Page 19: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Set up plugin.xml

❖ Copy from org.dita.xhtml folder

❖ Simplify

<plugin id="com.scriptorium.myhtml"> <feature extension="dita.xsl.xhtml" file="xsl/myxsl.xsl"/></plugin>

Wednesday, February 22, 12

Page 20: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Set up conductor.xml

❖ Copy from org.dita.xhtml

❖ No changes

Wednesday, February 22, 12

Page 21: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/ XSL/Transform" version="1.0">

<xsl:template name="gen-user-header"> <div><img src="http://www.scriptorium.com/ images/HeaderImage.png" alt="scriptorium.com"/></div></xsl:template>

</xsl:stylesheet>

myxsl.xsl (in xsl folder)

Wednesday, February 22, 12

Page 22: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Integrate your changes

$ ant -f integrator.xmlBuildfile: integrator.xml

lax:

integrate:

BUILD SUCCESSFULTotal time: 1 second$

Wednesday, February 22, 12

Page 23: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Test the new plugin

❖ Same command as before

$ ant -f build.xml -Dargs.input=/DITA-OT1.5.4/doc/userguide.ditamap -Doutput.dir=/out -Dtranstype=xhtml

Wednesday, February 22, 12

Page 24: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

More XSL customization

❖ Copy template from dita2xhtml.xsl (or referenced files) into myxhtml.xsl

❖ Modify as you like

Wednesday, February 22, 12

Page 25: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Specifying custom CSS

flickr: ffg

Wednesday, February 22, 12

Page 26: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Specifying custom CSS

❖ Set up your own build file

❖ Fix file paths

❖ Point build file at the custom CSS you want

Wednesday, February 22, 12

Page 27: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Creating a custom build file❖ In samples/ant_sample, locate

sample_xhtml.xml

❖ Put a copy in the root OT folder and rename it: build_myxhtml.xml

Wednesday, February 22, 12

Page 28: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Fix the file paths in custom build file

<property name="sample.output.dir" value="/out/sample"/><property name="css.source.dir" location="${dita.dir}/plugins/com.scriptorium.myhtml/css"/>

Wednesday, February 22, 12

Page 29: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Optionally, modify other settings❖ args.input to specify the ditamap to

process

❖ args.css for the CSS file name

❖ args.csspath for the CSS directory path

Wednesday, February 22, 12

Page 30: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Run custom build and admire the results

flickr: tompeters1994

Wednesday, February 22, 12

Page 31: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Run custom build and admire the results❖ Arguments are not needed if you

customized the build file with your exact settings

$ ant -f build_myxhtml.xml -Dargs.input=/Users/okeefe/Documents/CSinTC/csintc.ditamap -Doutput.dir=/out -Dtranstype=xhtml

Wednesday, February 22, 12

Page 32: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Beyond the basicsflickr: jpockele

Wednesday, February 22, 12

Page 33: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

You will need…

❖ XHTML or HTML5

❖ CSS

❖ Apache Ant

❖ XSLT

❖ XML DTDs

❖ XSL-FO (for PDF customization)

Wednesday, February 22, 12

Page 34: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Take care of formalities

flickr: Carly & ArtWednesday, February 22, 12

Page 35: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Keep changes in plugins folder and custom build files

❖ Do not change core Open Toolkit

❖ Use code comments extensively

Wednesday, February 22, 12

Page 36: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Document your changes!

amazon.com

Wednesday, February 22, 12

Page 37: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Q & Aflickr: gracewong

Wednesday, February 22, 12

Page 38: Down the Rabbit Hole: Getting Started with the DITA Open Toolkit

Visit our booth…

❖ Sarah O’Keefe

[email protected]

❖ Twitter: @sarahokeefe

❖ www.scriptorium.com

❖ BTW, we’re hiring.

❖ Also, we have chocolate.

Wednesday, February 22, 12


Recommended