XML Professional Publisher: Transforming Data

for use with XPP 8.4 updated February 2016 Notice © SDL plc 1999, 2000, 2003-2016. All rights reserved. Printed in U.S.A. SDL plc has prepared this document for use by its personnel, licensees, and customers. The information contained herein is the property of SDL and shall not, in whole or in part, be reproduced, translated, or converted to any electronic or machine-readable form without prior written approval from SDL. Printed copies are also covered by this notice and subject to any applicable confidentiality agreements. The information contained in this document does not constitute a warranty of performance. Further, SDL reserves the right to revise this document and to make changes from time to time in the content thereof. SDL assumes no liability for losses incurred as a result of out-of-date or incorrect information contained in this document. Trademark Notice See the Trademark Notice PDF file at docs.sdl.com for trademark information. U.S. Government Restricted Rights Legend Use, duplication or disclosure by the government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or other similar regulations of other governmental agencies, which designate software and documentation as proprietary. Contractor or manufacturer is SDL plc, 201 Edgewater Drive, Wakefield, MA 01880-1296. This document was composed and paginated using SDL XML Professional Publisher.

ii Transforming Data Contents

About This Manual

Where Do I Start? ...... xvi

Conventions Used in This Manual ...... xvii

For More Information ...... xix

Part I Importing and Transforming Text

Chapter 1 Support in XPP

Working with text and Unicode ...... 1-2 XML/SGML ...... 1-2 ASCII Text ...... 1-3 XyASCII Text ...... 1-3 XSF Text ...... 1-3 The Xyvision Character Set ...... 1-3

Transforming Content from Earlier XPP Versions ...... 1-5 Running the Transformation Process Manually ...... 1-5 Character Transformation ...... 1-5 Transformation ...... 1-7 Style Transformation ...... 1-7 Transforming Between ASCII and Unicode ...... 1-7 ASCII File to XSF Summary ...... 1-8 XSF to ASCII Summary ...... 1-9

Transforming Data Contents iii Using ASCII Files ...... 1-9

Working with ASCII Files ...... 1-10 Default Naming Conventions ...... 1-10 Edit ASCII File or View File as ASCII ...... 1-10

Using Tag Primitives to Separate Text into Streams ...... 1-12 Understanding Tag Primitives ...... 1-12 Using Stream Diversion in the Export Process ...... 1-13 Stream Order ...... 1-14 Stream-End Delimiter ...... 1-14 Using Stream Diversion in the Import Process ...... 1-14 Footnote and Pickup References ...... 1-15 Marking Footnotes in ASCII Text ...... 1-16 Marking Pickups in ASCII Text ...... 1-16 Marking Pickup Elements in ASCII Text ...... 1-19 Arguments for Graphic Tag Primitives ...... 1-19 Arguments for Pickup Element Blocks ...... 1-21 Marking Stories in ASCII Text ...... 1-23 Converting Microns to Standard Units ...... 1-24

XSF Text / ASCII Examples ...... 1-25 Example 1: XSF Text ...... 1-25 Example 2: ASCII Text Strings ...... 1-26

Chapter 2 FromXSF and ToXSF

Overview ...... 2-2

Using FromXSF ...... 2-3 Running FromXSF from PathFinder ...... 2-4 Running FromXSF from the Command Line ...... 2-4 Using FromXSF on Multiple Divisions within a Job ...... 2-4 Inserting Header and Trailer Strings With FromXSF ...... 2-6 Inserting Header and Trailer Strings in XML/SGML Mode . 2-7 /FOOT ...... 2-7 /FOOTPG ...... 2-8 Preserving Editing Traces with FromXSF ...... 2-9 Examining a File Containing Trace Xyps ...... 2-9 Using FromXSF in XML/SGML Mode ...... 2-11 Suppressing XPP PI in XML/SGML Mode ...... 2-11 Selecting Type of Output ...... 2-11 Specifying Units for Layout Field Information ...... 2-12

Using ToXSF ...... 2-13 ToXSF Support ...... 2-13 XyASCII ...... 2-13 CJK Characters ...... 2-13

iv Contents Transforming Data Autoprocessing ...... 2-13 Numeric Character References ...... 2-13 Running ToXSF ...... 2-14 Running ToXSF from PathFinder ...... 2-14 Running ToXSF from the Command Line ...... 2-16 Replace Modes ...... 2-16 Page Replace/Insert/Append Mode (-Rep and -Ret) ...... 2-17 Replacing Main Pages ...... 2-17 Inserting Main Pages ...... 2-18 Appending Main Pages ...... 2-19 Replace/Insert/Append Footnotes, Pickups and Stories ... 2-19 Replacing Split Pickups ...... 2-19 Updating Frozen Pickups ...... 2-20 –Rep versus –Ret ...... 2-20 Page Re-Create Mode (–Rec) ...... 2-20 Page Replace Mode (–Rep and –Ret) and Maximum Page Sizes ...... 2-21 Layout Control Designators (–layout and –nofrills) ...... 2-22 SGML Character Entities (–asc) ...... 2-23 ToXSF and Line Endings ...... 2-23 Loop Processing of Input Text (–Ln) ...... 2-24 ToXSF Error Checking ...... 2-24 Legal Non-printing Control Characters ...... 2-25 Missing Begin/End Tag, Xycode, or Tag Primitive Characters . 2-26 ToXSF Page Formats and Sizes ...... 2-27 Footnote Tag Primitives ...... 2-28 ToXSF Help File ...... 2-28 Tag Primitives Help File ...... 2-28

Restoring Divisions ...... 2-29

Chapter 3 XyChange

Understanding XyChange ...... 3-2 An Overview of the Transformation Process ...... 3-2 What Do You Need To Transform? ...... 3-3 Setting Up XyChange Transformation Tables ...... 3-4 Running XyChange ...... 3-4 Transformation Types ...... 3-4 Unconditional Transformation ...... 3-4 Conditional Transformation ...... 3-5 Writing Transformation Tables ...... 3-5

Setting Up XPP Transformation Tables ...... 3-7 Completing the Job Ticket ...... 3-7

Transforming Data Contents v Creating Files for Transformation Tables, Scripts, and Style Sheets ...... 3-9 Sample Perl Script ...... 3-9 Accessing a Transformation Table, Script, Style Sheet ...... 3-10 Structure of a Transformation Table ...... 3-11 XPP Transformation Table Fields ...... 3-12

Using Match and Output Strings ...... 3-14 Guidelines for Match and Output Strings ...... 3-14 Escape Sequences in Match and Output Strings ...... 3-15 Escape Sequence Formats ...... 3-16 XSF Characters and ASCII Strings ...... 3-17 Notes on Translating Special XPP Characters ...... 3-19

Running the XyChange Program ...... 3-21 XyChange Processing Sequence ...... 3-21 Guidelines for Running XyChange ...... 3-22 Running XyChange from PathFinder ...... 3-22 Running XyChange from the Command Line ...... 3-24

Sample XyChange Transformation Process ...... 3-26 ASCII File Before Transformation ...... 3-26 Sample Transformation Table Rules ...... 3-27 ASCII File After Translation ...... 3-29 Composed File in Page Mode ...... 3-30

Chapter 4 Advanced XyChange Techniques

Using Wildcards in Transformation Rules ...... 4-2 Single-Character Wildcards in Match Strings ...... 4-2 Guidelines for Using Single-Character Wildcards ...... 4-3 Multiple-Character Wildcards in Match Strings ...... 4-4 Guidelines for Using Multiple-Character Wildcards ...... 4-5 Using Wildcards in Output Strings ...... 4-5

Using If True and Then Do Fields ...... 4-7 Guidelines for the If True Field ...... 4-8 Comparative Operators ...... 4-9 Binary Operators ...... 4-9 Unary Operators ...... 4-10

XyChange Variables ...... 4-11 String Variables ...... 4-11 Numeric Variables ...... 4-11 Wildcard Variables ...... 4-12 Using Variables in Setting Test Conditions ...... 4-12 Comparing Variables in If True Expressions ...... 4-12 Using Wildcard Variables in If True and Then Do Fields ... 4-13

vi Contents Transforming Data Using Wildcard Variables in Output Strings ...... 4-13 Displaying Variable Values ...... 4-14

Quoted Strings ...... 4-17 Guidelines for Using Quoted Strings ...... 4-17 Transferring Numeric and String Variables ...... 4-17

Using the Reinput Command ...... 4-19 Guidelines for Using the Reinput Command ...... 4-19 Avoiding Infinite Loops ...... 4-20

Using the Debug Command ...... 4-21

Chapter 5 XSFChange Program

Understanding XSFChange ...... 5-2

Accessing the XSFChange Program ...... 5-3

Understanding The XSFChange Spec ...... 5-5 Fields in the XSFChange Spec ...... 5-5 Output Order of Text Types ...... 5-6 Type of Pickup Element Blocks ...... 5-7 Miscellaneous Output Information ...... 5-8 Transformation Table Location and Name ...... 5-12

Converting Divisions ...... 5-13 Running XSFChange from PathFinder...... 5-13 Running XSFChange from the Command Line ...... 5-13

Viewing the txsfout File ...... 5-14 Sample ...... 5-14

Part II Importing and Transforming Styles

Chapter 6 Importing and Exporting Page Layouts

Layout Control Designators ...... 6-2

Using ToXSF to Import Page Layouts ...... 6-3 Importing Layout Pages with Text ...... 6-3 Importing Layout Pages Only ...... 6-3 ToXSF Command to Import Layout Pages with/without Text . 6-3

Using FromXSF to Export XPP Page Layouts ...... 6-5 Exporting Pages Containing Text ...... 6-5 Exporting Layout Pages Only (Without Text) ...... 6-5

Transforming Data Contents vii FromXSF Command to Export Layout Pages with/without Text ...... 6-6 ToXSF/FromXSF Layout Control Statements ...... 6-7 Unit Qualifiers ...... 6-7 Designator [PAGE] ...... 6-7 Page Layout Copy Control [CPPAGE] ...... 6-8 Frame Layout Control [FRAME] ...... 6-8 Block Layout Control [BLOCK] ...... 6-9 Shape Primitive [SHAPE] ...... 6-10 Examples of Layout Control Statements in ASCII Text ...... 6-11 Creating a Division with Text ...... 6-11 Replacing Two Pages in a Magazine ...... 6-12 Defining a Book ...... 6-13

Hints and Troubleshooting ...... 6-14

Chapter 7 Transforming Style Data in XPP

Examples of Importing and Exporting Styles ...... 7-2 Exporting Styles ...... 7-2 Importing Styles ...... 7-4 Original Page Layout Spec ...... 7-4 ASCII Input File with Page Layout Data ...... 7-5 Modified Page Layout Spec ...... 7-6

Understanding XPP and ASCII Style Data Formats ...... 7-7 Format of XPP Style Data ...... 7-7 Format of ASCII Export File ...... 7-7 Format of ASCII Import File ...... 7-9 Descriptor Format ...... 7-11 Command Format ...... 7-12 Examples of ASCII Import Files ...... 7-13

Creating ASCII Style Files for Import ...... 7-14 Field Contents ...... 7-14 Entering Accented Characters in ASCII Fields ...... 7-15

Using the Style Data Editor ...... 7-17

Importing/Exporting XML Style Files ...... 7-18 Import/Export Process Components ...... 7-18 XML Style Files ...... 7-18 and Conversion ...... 7-19 Schema Support ...... 7-20 The Programs ...... 7-20 Sdedit Program ...... 7-20 I/O Style Program ...... 7-21 iostyle.pl ...... 7-22 Style Data File Modification ...... 7-22

viii Contents Transforming Data Related XPP Specs ...... 7-23

Part III Autoprocessing

Chapter 8 Autoprocessing

Understanding Autoprocessing ...... 8-2 Processing Text Files ...... 8-2 Autoprocessing Limitations ...... 8-2 Matching Time and Date on Networked Systems ...... 8-3 Setup Files ...... 8-3 Setting Up Windows Services ...... 8-3 Autoprocessing Configuration Spec (sap config) ...... 8-3 Background Processing Configuration Spec (bgq config) ... 8-3 Monitoring Input Directories ...... 8-4 Processing Input Files ...... 8-4 Reprocessing Input Files ...... 8-6 Autoprocessing File Management ...... 8-6

Setting Up the Autoprocessing Configuration Spec ...... 8-7 Accessing the Autoprocessing Configuration Spec ...... 8-7 Structure of the Autoprocessing Configuration Spec ...... 8-8 Autoprocessing Configuration Spec Fields ...... 8-8 Creating a New Rule ...... 8-11

Process Command Lines ...... 8-12 Process Command Placement ...... 8-12 Process Commands in the Autoprocessing Config Spec .... 8-12 Splitting Process Commands ...... 8-13

Autoprocessing Text Command Lines ...... 8-15 Text Processing Command Format ...... 8-15 Sample Text Processing Command Entries ...... 8-21 Specifying Transformation Tables ...... 8-22 Specifying Arguments for Secondary Text ...... 8-22 Appending Input Text to Existing Division ...... 8-23 Replacing an Existing Division ...... 8-23 Specifying an Alternate Document Root ...... 8-24

Autoprocessing Error Log ...... 8-25

Autoprocessing Graphics Command Lines ...... 8-26 Graphics Processing Command Format ...... 8-26 Sample Graphics Processing command Entries ...... 8-26 Converting TIFF Files ...... 8-26 Converting EPS Files ...... 8-26

Transforming Data Contents ix Document Processing Interface ...... 8-27 Purpose of Document Processing Interface ...... 8-27 Definition of commz.pl ...... 8-27 Command Line Format ...... 8-28 Supported Options ...... 8-29 Examples for Using commz.pl ...... 8-30 Running ToXSF, Compose, and PSFMTDRV Repeatedly ... 8-30 Customizing Processes for Use with XML ...... 8-31 Calling a Custom Script After Document Creation, Conver- sion, and Composition ...... 8-32

Part IV Transforming Alternate Formats

Chapter 9 Transforming Asian Languages

Overview of Asian Language Support ...... 9-2 Transformation Process for Upgrading Sites ...... 9-2 Entering CJK Characters ...... 9-2 Setting OS Locale Setting in XPP 8.0 ...... 9-3 Supported Asian Language Formats ...... 9-3 Chinese Hong Kong Character Set ...... 9-4

Running the JPCIN Transformation Utility ...... 9-5 JPCIN Transformation Rules ...... 9-5 JPCIN from the Command Line ...... 9-6 JPCIN from PathFinder ...... 9-7 JPCIN with Autoprocessing ...... 9-8

Chapter 10 Importing and Exporting XML/SGML Data

Importing XML/SGML Instances to XPP ...... 10-2 Performing Other Transformations on Import ...... 10-2 Import Tab ...... 10-2 Transform Tab ...... 10-2 Searching for the catalog.xml file ...... 10-3 The Import Process ...... 10-3 Transforming Content to UTF-8 ...... 10-3 Searching for the omnimark.lib file ...... 10-4 Public or System Identifier ...... 10-4 Parsing the XML/SGML Instance ...... 10-4 Importing the file to XPP ...... 10-5

Options for Importing XML/SGML Instances to XPP ...... 10-10

x Contents Transforming Data Enabling XML/SGML Transformation ...... 10-11 XCS Spec ...... 10-11 XCS Header Fields ...... 10-11 XCS Body Records ...... 10-12 Job Ticket ...... 10-13 Division Ticket ...... 10-13

Transforming a Division to an Output File ...... 10-14 Transforming the XPP Division ...... 10-14 FromXSF Tab ...... 10-14 FromXSF Processing ...... 10-15

FromXSF Options ...... 10-16 Transforming ASCII to Other Formats ...... 10-17 Export Tab ...... 10-17 Transform Tab ...... 10-17

Appendix A Xyps and System Codes

Xyp and System Code Tables ...... A-2 Xyps ...... A-2 System Codes ...... A-6

Xyp and System Code Classes ...... A-8

Line End Types ...... A-9

Appendix B XCS Assignments for XML/ SGML Character Entities

Glossary

Index

Transforming Data Contents xi Figures

3-1 XyChange fields in the Job Ticket ...... 3-7 3-2 Transformation Table ...... 3-11 3-3 ASCII File Before Transformation ...... 3-26 3-4 Transformation Table Rules ...... 3-27 3-5 ASCII File After Transformation ...... 3-29 3-6 Composed File in Page Mode ...... 3-30

5-1 Sample XSFChange Program Spec ...... 5-5 5-2 Sample txsfout File Containing All Codes ...... 5-15 5-3 Sample txsfout File Containing End of Line Codes ...... 5-16 5-4 Sample txsfout File Containing Math Codes ...... 5-17

6-1 ASCII Input File named tsample1 ...... 6-11 6-2 ASCII Input File Named tsample2 ...... 6-12 6-3 ASCII Input File Named tsample3 ...... 6-13

7-1 Sample Item Format Spec ...... 7-2 7-2 ASCII File Containing Exported Item Format Data ...... 7-3 7-3 Sample Page Layout Spec ...... 7-4 7-4 Sample ASCII File to Import Page Layout Style Data ...... 7-5 7-5 Sample Page Layout Spec After Modification ...... 7-6 7-6 Format of ASCII Export File ...... 7-8 7-7 Format of ASCII Input File ...... 7-9 7-8 Vuem Characters ...... 7-16

8-1 Sample Autoprocessing Configuration Spec (SAP) ...... 8-8

xii Contents Transforming Data Tables

1-1 Automatic Transformation of XCS Characters to Unicode ...... 1-6 1-2 List of XPP Tag Primitives in Classic Mode ...... 1-12 1-3 List of XPP Tag Primitives in XML/SGML Mode ...... 1-13 1-4 Footnote and Pickup Anchors ...... 1-15 1-5 Footnote Tag Primitive Arguments ...... 1-16 1-6 Arguments for Pickup Tag Primitives ...... 1-17 1-7 Arguments for Graphic Tag Primitives ...... 1-19 1-8 Arguments for Caption, Annotation, and Title Element Blocks .. 1-21 1-9 Arguments for the Story Tag Primitive ...... 1-23

3-1 XyChange Command Set Characters ...... 3-17 3-2 Xyvision Characters and Their ASCII Sequences ...... 3-17

4-1 Examples of Single-Character Wildcards ...... 4-3 4-2 Format of a Multiple-Character Wildcard ...... 4-4 4-3 Examples of Multiple-Character Wildcards ...... 4-5 4-4 Comparative Operators ...... 4-9 4-5 Binary Operators ...... 4-9 4-6 Unary Operators ...... 4-10 4-7 Examples of Valid If True Tests ...... 4-13 4-8 Format of the Variable Output String ...... 4-14 4-9 Examples of Displaying the Contents of Variables ...... 4-16 4-10 Examples of Quoted Strings in If True and Then Do Fields ..... 4-18 4-11 Examples of the Reinput Command in Then Do Fields ...... 4-19

5-1 Tag Primitives ...... 5-8

6-1 Layout Control Designators ...... 6-2 6-2 Options to Import Page Layouts ...... 6-4 6-3 Switches to Export Page Layouts ...... 6-6 6-4 Problem/Solutions ...... 6-14

7-1 Format of Descriptor Entries ...... 7-11 7-2 Format of Command Entries ...... 7-12 7-3 Character Conversion during XML Style Import/Export ...... 7-19 7-4 XPP Style Spec Mnemonics ...... 7-23

8-1 Options for new-div, convert, compose, and queue ...... 8-16 8-2 Options for convert and compose ...... 8-17 8-3 Options for compose ...... 8-18 8-4 Options for queue ...... 8-19 8-5 Options for Special Occasions ...... 8-21 8-6 Some New Options for commz.pl ...... 8-29

10-1 Comparison of Tag Primitives ...... 10-7

Transforming Data Contents xiii A-1 Xyps ...... A-2 A-2 System Codes ...... A-6 A-3 Xyps and System Code Classes ...... A-8 A-4 Line End Types ...... A-9

xiv Contents Transforming Data About This Manual

Transforming Data describes how to change text, styles, and graphics from formats created on other systems to formats that XPP uses.

This manual addresses the following topics:

• Supporting Unicode in XPP • Transforming text with the ToXSF and FromXSF utilities • Transforming text with the XyChange option • Using XSFChange • Importing and exporting page layouts • Transforming styles with the ToStyles/FromStyles functions • Automating the transformation process using autoprocessing • Working with Asian languages • Importing and exporting XML/SGML data

Transforming Data About This Manual xv Where Do I Start?

...... Where Do I Start?

This manual is intended for anyone who needs to import data from elsewhere into XPP. It combines conceptual information with detailed procedures for accomplishing specific tasks.

Before using this manual, you should be familiar with XPP publishing software and its system commands. If you are not familiar with these, refer to the appropriate XPP or system documentation.

If you are . . . Read this... Working with text only Chapter 1 Learning to import and export ASCII text Chapter 2 Learning XyChange techniques Chapter 3 Learning advanced XyChange techniques Chapter 4 Using XSFChange Chapter 5 Importing and exporting page layouts Chapter 6 Importing and exporting style data Chapter 7 Automating the transformation process Chapter 8 Importing Asian Languages Chapter 9 Importing files containing XML/SGML markup Chapter 10

xvi About This Manual Transforming Data Conventions Used in This Manual

...... Conventions Used in This Manual

This manual uses a set of symbolic, typographic, and terminology conventions to categorize specific information. Take a few moments to become familiar with these conventions before you use this manu