© copyright 2002, dorothy j. hoskins textenergy llc xml under the hood why, where and how to use...

61
© Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood XML Under the Hood XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented at “XML in the Real World” workshop November 8 th , 2002 Rochester, NY Dorothy Hoskins, principal, Textenergy LLC

Upload: lizeth-chumbley

Post on 14-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. Hoskins Textenergy LLC

XML Under the Hood

XML Under the HoodXML Under the Hood

Why, Where and How to Use XMLTarget Audience:

Technical CommunicatorsPresented at “XML in the Real World” workshop

November 8th, 2002Rochester, NY

Dorothy Hoskins, principal, Textenergy LLC

Page 2: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

What we’ll cover todayWhat we’ll cover today

• Business reasons for using XML• How XML impacts writing and production

workflows, job trends, tools, implications• XML basics with hands-on exercise• XSL basics with hands-on exercise

Page 3: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. Hoskins Textenergy LLC

XML Under the Hood

XML and the Writing XML and the Writing EnvironmentEnvironment

Part 1 of “XML Under the Hood”

Business reasons for using XMLHow XML impacts writing and production workflows,

job trends, tools, implications

Page 4: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML: Wave of the Future?XML: Wave of the Future?

• When HTML was new, no one anticipated how pervasive and disruptive the technologies would be.

• HTML conquered obstacles to delivering content anywhere in the world, any time.

• Did you accept its limitations and dive in? Are you doing web work but wish you weren’t, because the quality isn’t what you want?

• Is XML any better?

Page 5: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML: Wave of the Future?XML: Wave of the Future?

• XML does not solve web presentation problems. It does make it possible to create content for both web and print delivery simultaneously.

• XML is much more powerful, flexible and robust than standard HTML.

• XML can be counted on to acquire more uses, drive new tools, and be as unexpected in its impact as the web was in the 90’s.

• You can choose to:– jump on the wave now, – wait for the initial crest to pass– ignore it and hope you don’t have to swim later.

Page 6: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Why Is XML Getting Why Is XML Getting So Much Buzz?So Much Buzz?

• XML meets many business needs.• XML creates “neutral” content sources.• XML is web-friendly (and almost print-friendly).• XML underlies Microsoft .Net and other web

services, and expands the interoperability of programming exponentially.

• Everyone’s doing it: legal, automotive, pharmaceutical, government/regulatory, open source community, leading developers (Sun, IBM, Microsoft, Adobe, Quark, Corel, etc.)

Page 7: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Why Does Business Like XML?Why Does Business Like XML?

• XML is open-source, non-proprietary• By creating XML, businesses can exchange

information between different computing platforms/OS, among different applications

• XML can be served to users on-line, in print, even to cell phones and PDAs from the same source materials (aka “content”)– The visual representation (“presentation”) can

be changed without altering the content itself

Page 8: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Why Does Business Like XML?Why Does Business Like XML?

• XML is used for representing narrative content, data records, even processing instructions.

• Makes integration of business processes seamless across enterprise, with partners and channels

• For publishing, makes print and web efforts more congruent and synchronized, permits personalization of content by user profiles

• Provides faster time to market, fewer errors that could result in customer anger/lawsuits

• Now often used for regulatory filings and to comply with government systems (SEC, FDA)

Page 9: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Why Does Business Like XML?Why Does Business Like XML?

• Bottom-line results can be impressive after initial investment to create content creation and production workflows. Often pays for itself in 6-12 months.

• May permit more work to be done by fewer production personnel, allow “writers to write” instead of formatting content.

• Excellent solution for remote workers via web-based interfaces.

Page 10: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Why Do Publishing Depts. Why Do Publishing Depts. Like XML?Like XML?

• Provides reliable, systematic content development process for consistent output

• Reduces rework by writers and production staff, increases accuracy

• Streamlines output to multiple formats• Integrates print publishing with web site

development, can be dynamictheoretically faster + cleaner + easier

Page 11: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Why Do Publishing Depts. Why Do Publishing Depts. Like XML?Like XML?

• Makes translations more accurate, easier to track progress

• Reduces training time for new hires to get up to speed by providing template-based authoring tools– Designers make presentation templates– Information specialists make structures– Writers create value in content

theoretically faster + cleaner + easier

Page 12: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Content management Content management and single sourcingand single sourcing

• “Content management” generally refers to a system to store content (as docs or chunks), locate it for reuse, track revisions and work history. CM combines a database with management software.

• “Single sourcing” generally refers to methods for developing content in a controlled method that can be delivered in multiple formats without “tweaking”. SS is often application-based (i.e., FrameMaker, WebWorks Publisher, AuthorIT).– Single source applications and content management

systems can be used together. SS is “author-centric”, CM is “admin-centric”

Page 13: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Content management Content management and single sourcingand single sourcing

• Trend is for CM and SS solutions to become XML-enabled (provide ways to consume and produce XML) to integrate w/ other business processes

• Often, products are bundled: authoring tool, repository (database), management tools for control of access/approvals and version tracking, publishing automation tools.

• High-end solutions are enterprise CM systems such as Documentum, Arbortext. Lower-end are usually combinations of custom-built and COTS software.

Page 14: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Content management Content management and single sourcingand single sourcing

• Businesses may need a CMS to achieve critical control of the content creation and delivery processes (especially true when web is a vital part of the business model).

• Pub dept. may need SS to meet business demands for speed, quantity and accuracy.

• Pub dept. cannot make SS or CM work without management support/resources

Page 15: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Pub dept. pain pointsPub dept. pain points

• “Pain points” are roadblocks to getting your jobs done. They can arise from difficulties in doing your job as a writer, getting approvals, finding materials to work with, “version hell”, translation cycle times, reformatting for different output needs.

• Pain must be significant to move into SS and/or CM. Missed deadlines, budget overruns and lawsuits cause real pain.

Page 16: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Pub dept. pain pointsPub dept. pain points

• Which of these apply to you? [pain point assessment]• Can’t find the approved version to start a project.• Asked to provide in different file format(s) from original.• Have to translate to 5+ languages after approval, but have

to reformat all translated materials, cut/paste.• Have to key in edits from hard-copy corrections.• Old files in formats that are not used now.• Can’t collaborate on same file. Can’t access files away from

office. Can’t tell who worked on file, what changed when. Can’t go back to previous version of content.

• Need to make different content versions for different user populations (part common content, part customized), maybe “conditional” acc. to Euro, Asian, American markets).

Page 17: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML is not a cure-allXML is not a cure-all

• The role of XML is providing content in an “application neutral format” that can be used by an incredible variety of applications on UNIX, Windows, Mac, Linux.

• Since it’s just a text-based encoding system for marking up information, it requires tools for authoring and production. (WYSiWYG tools are just getting useful.)– XML requires formatting templates for all presentation

outputs. Template creation requires skilled developers.• It doesn’t create value by itself. It has to be used well.

– XML must be “valid” to meet critical business needs; it must conform to set of established rules (a DTD or schema) for validated processing.

Page 18: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML Must Fill a Business NeedXML Must Fill a Business Need

• To sum up, XML is used to improve business processes and provide efficiencies in working with disparate OS and applications.

• XML makes it easier to integrate CM and SS with current applications and databases. It’s “under the hood” of many tools already.

• Should you use XML? Assess your situation, plan for migrating if it will meet your needs.

• First steps: clean up your documents, control your authoring processes.

Page 19: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

A Word about DTDs and A Word about DTDs and SchemasSchemas

• Document Type Definitions (DTDs) come from SGML. DTDs provide rules for the allowable elements and attributes in a document, their order and number of occurrences.

• Schemas in XML provide the same kind of rules, plus “data typing” to control whether content is in string, numerical, date, etc. data types.

• DTDs prevail at present in publishing.Schemas are fast taking over in web-and data-oriented applications.

Page 20: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML and the Writer/ProducerXML and the Writer/Producer

• Good news: Unless the business drivers and pain points are significant, you can wait for better tools and you don’t have to code XML yourself .

• Bad news: Your usual ways of doing your job aren’t sufficient productive to continue. – Management will not continue to pay writers to

format content (estimated 30% of your job today).

– You’ll have to come to grips with automation of formatting, learn new ways to write, accept the Darwinism of the market (“adapt or die”).

Page 21: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML and the Writer/ProducerXML and the Writer/Producer

• New concepts to learn: – Content in context– Reuse of content at sub-document level– Presentation not tied to writing

• New tools to use:– Single-sourcing applications– Databases and query languages

• New work opportunities to explore:– Specialize in information design, content analysis,

template design, content administration, training– Be an expert on indexing, production tool, ss

application

Page 22: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

The State of Authoring ToolsThe State of Authoring Tools

• For “structured writing”: – FrameMaker meets tech manual needs best. – Quark Xpress and Adobe InDesign are useful for

newsletters, datasheets. – MS Word (with 3rd-party tools) is for content providers

who don’t have or need better publishing applications.– Star Office is XML-enabled office suite,

imports/exports MS Word docs, very reasonable price ($89)

• For XML authoring directly:– XMetal (now owned by Corel) – XML Spy from Altova.

Page 23: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

The State of Authoring ToolsThe State of Authoring Tools

• Those who already know how to build and use a FrameMaker + SGML “structured application” will find it easy to adapt for XML.

• Those who use non-SGML FM must learn to write in structured manner. Also someone must create DTD, EDD, read-write rules (usually a consultant or in-house specialist).– Application developers are now making server

products (database + management) for automating production from their applications. The Adobe one is called “Framemaker Server” for networked FM work.

Page 24: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

The State of Authoring ToolsThe State of Authoring Tools

• FrameMaker has “save as XML” and “save as HTML”, both through mapping tables– Mapping may need an FM expert to set up

(tedious).– FM does not have tools for mapping XML to

HTML.– Also tools for creating advanced PDF

documents (maintain hyperlinks, auto-generate TOC) and tagged PDF files (reflowable to adjust to different screen sizes).

Page 25: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

The State of Authoring ToolsThe State of Authoring Tools

• Quark Xpress allows “drag and drop” mapping between the Quark paragraph tags and the elements of a DTD, XML export after mapping. XML import within Quark is “roundtrip”, but the XML produced may cause problems with other tools. Poor web page production tools (v.5).

• Adobe InDesign has similar graphical mapping tools, also requires DTD, has better XML output. Also integrated w/ advanced PDF production, has“save as HTML.”

Page 26: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

The State of Authoring ToolsThe State of Authoring Tools

• Converter applications have been developed for turning docs into XML (MS Word, FrameMaker, Quark Xpress, WordPerfect). – Require a consistent authoring process,

may be guided by a writing template. – Most appropriate for small docs, not big

books. Really shines for forms, reports.• Conversion specialists can do bulk conversion of

“legacy content” if there are many docs that must be converted in a short time.

• Pubs dept. should evaluate all conversion needs, do triage, phase in, “don’t convert what you won’t use”

Page 27: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

The State of Authoring ToolsThe State of Authoring Tools

• No single tool provides all the quality we want, all the advanced capabilities we are looking for, all the output formats we need -- yet.

• Decide on tools after you decide on processes, which should be determined by evaluating how you do things now and how you want to do them in future. Analyze > plan > implement.

• Plan on training on tools, information design, template development, new writing concepts.

Page 28: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. Hoskins Textenergy LLC

XML Under the Hood

XML and XSLXML and XSL

Part 2 of “XML Under the Hood”

Basic XML: Structure and MeaningBasic XSL: Transformation for Presentation

Including Hand-On Exercises

Page 29: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

• eXtensible Markup Language is the markup language for describing an information structure (hierarchy) and its meaning (semantics)

• XML does not provide formatting information (fonts, colors, placement)

• XML can be valid (adhere to a Document Type Description or schema), must be well-formed (written in correct XML syntax)– More flexible than SGML, more stringent than

HTML

What’s XML?What’s XML?

Page 30: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML is a declarative languageXML is a declarative language

• Each XML document must start with a declaration of its document type and version in XML syntax.

<?xml version="1.0" encoding="UTF-8"?>

– Encoding (optional in declaration) is UTF-8 by default, can be UTF-16 or other.

• The declaration lets a parser know that it’s working with an XML document that conforms to a version of the XML spec at W3C. – Parsers handle XML differently (MS vs. Apache,

etc.)

Page 31: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML describes structureXML describes structure

• Each XML document must have a root element that encloses all other elements (user-named). <document>The root element name is whatever you like.</document>

• Often represented as a “tree” structure. Each element within the structure is a node.– Nodes with children are “branches ”– Nodes without children are “leaves”

<document> <mainelement>

<nested_element>This is the actual content. </nested_element> <nested_element>Another leaf node, no children.</nested_element>

</mainelement> </document>

Page 32: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML provides meaning XML provides meaning and metadataand metadata

• The hierarchical structure of the xml document is tagged with meaningful names about the information contained in it. – May be generic, quasi-structural names

<chapter> <section> <subsection> <heading1> <para> <list> <listitem>

– May be derived from data tables’ column names

<order><orderno> <shipto> <name> <last>

Page 33: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML provides meaning XML provides meaning within metadatawithin metadata

• Some elements may be used to describe information about the information itself.– May be related to work processes <creator>

<createdate> <revno> <revdate> <reviewer>– May be related to usage of content

<copyright><publisher> <ISBN> <pubdate> <author> <title> <category>

– May be related to type of content <imagetype> <media> <format> <url> <link>

• Information about information is “metadata”.

Page 34: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML metadata provides ways XML metadata provides ways to use information in systemsto use information in systems

• Metadata is used to identify content “chunks” in repositories (aka databases).

• It can be used to select, filter and order content within a CMS, or via a browser request.– Metadata may be created automatically as part

of an authoring or workflow program. – Metadata may never be seen by end-users who

receive the content in print or on-line. Mostly used for “library” functions, content management and data interchange.

Page 35: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. Hoskins Textenergy LLC

XML Under the Hood

Put concepts to workPut concepts to work

Do-it-yourself exercisesYou’ll need:

1. A deck of cards (in your goodie bag)2. Paper and pencil (you’ll want to erase)3. Logic (yours is as good as anyone else’s)That’s all you need to understand and work with

XML in the beginning: an information set, a writing tool, and your brain.

Page 36: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Do-it-yourself exerciseDo-it-yourself exercise

• Take a deck of cards. Look it over and think about the structure of the information it contains. Ask yourself:

Bonus: What’s the content?

Are there more levels below the second level?

What’s the next level element?

What’s the root element?

Page 37: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Do-it-yourself exerciseDo-it-yourself exercise

• Write your own XML structure for the card deck. – Give the root element after the XML

declaration.– Write your element structure nested inside

your root element. • Remember that you have to finish each <elementname>

with a matching closing tag </elementname> and work in from the outside when nesting elements.

<document>

<mainelement> <nested_element>This is the actual content. </nested_element>

<nested_element>Another leaf node, no children. </nested_element>

</mainelement>

</document>

Page 38: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Using XML attributesUsing XML attributes

• Attributes are descriptive of some aspect or characteristic of an XML element.– Give the element more definition that

doesn’t really belong in a sub-element structure.

<section user=“advanced” version=“7.2”>

– May be used to create “conditional” output.<section user=“advanced” version=“7.2”> <heading1>Creating your own

subroutine</heading1><para>Open your macro script and insert the following lines of code:</para></section>

<section user=“beginner” version=“7.2”> <heading1>Using provided subroutines</heading1><para>Navigate to the source code directory and open subex01.</para></section>

Elements are like nouns, attributes are like adjectives.

Page 39: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Do-it-yourself exerciseDo-it-yourself exercise

• Think about what attributes are used for. Look at your element structure. Ask yourself:

What’s the smallest discreet part of the card deck that I want to be able to locate and manipulate?

Should any elements in my structure become attributes?

Page 40: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Do-it-yourself exerciseDo-it-yourself exercise

• Think about using the cards. Look at your element and attribute structure. Ask yourself:

Using my structure, could I locate any card in the deck as a unique object?

Is there more than one way to describe the structure that is understandable?

Page 41: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Some possible XML structuresSome possible XML structures

• This example has <cards> as the root element, then has the name of the suit <spades> as the next level, then has the name of the card <king>, etc. as the third level.– When the element has

no content, can representit as <king></king> or<king/> (both are correct).

cardsspades

clubs

kingqueenjacktennineeightseven

sixfivefour

threetwoace

king

Page 42: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Some possible XML structuresSome possible XML structures

• This example has <cards> as the root element, then has <suit> as the next level, then has <card> as the third level. The name of the suite or card is an attribute here. cards

suitecard

Page 43: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Some possible XML structuresSome possible XML structures

• This example has <cards> as the root element, then has the name of the suit <spades> as the next level, then has <card> as the third level. The name of the card is an attribute here.

cardsspades

hearts

clubs

diamonds

card

card

card

card

Page 44: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Some possible XML structuresSome possible XML structures

• Attributes can be used for each card’s suit (spades, hearts, diamonds, clubs). No card can have more than one suit. No suit = null value (represented by an empty attribute value). <card name=”joker” suit=””/></cards>

• The name of the card can also be an attribute; no card has more than one name.

• Together, these attributes allowfor sorting the cards by suitand by name, and can alsobe used to uniquely identifya card within the deck.

• Is a name the same as a value inthe context of using the cards?

cards

card

Page 45: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

From structure to presentationFrom structure to presentation

• When we use XML, the content is “presentation neutral”. There’s no formatting of the text to make it look good, provide visual cues to its organization.<?xml version="1.0" encoding="UTF-8"?><!--sample file created by D. Hoskins for ahnds-on XSL training session--><?xml-stylesheet type="text/xsl" href="G:\stc\xmlworkshop\handson_simple.xslt"?><chapter id="cmds"><chaptitle>FileMe</chaptitle><para>This chapter describes the commands that manage the <tm>FileMe</tm> internet application. It includes exercises for you to try out the commands yourself.</para><section><secthd>About the FileMe commands structure</secthd><para>FileMe commands are organized into three groups:</para><list><listitem>User Commands <ref/></listitem><listitem>Admin Commands</listitem><listitem>File Commands</listitem></list><para>You can try out the Admin Commands only if you have Administration level permissions to the server.</para><para>You can use the User and File Commands if you are a user or an administrator.</para><note>Please do not alter the exercise files. Copy them into a folder on your own computer before you begin <ref>Exercise One: File Commands</ref>.</note><section><secthd>Getting started with FileMe</secthd><para>Open the FileMe application and <ref>log in</ref> as a User with the default user name of <keybd>USER</keybd> (not case sensitive) and the password <keybd>begin1</keybd> (typed in all lowercase).</para><para>Open the FileMe application and <ref>log in</ref> as Admin with the default user name of <keybd user="admin">ADMIN</keybd> (not case sensitive) and the password <keybd user="admin">begin2</keybd> (typed in all lowercase).</para><para>Open the FileMe application and <ref>log in</ref> as USER with the default user name of <keybd user="">cabman</keybd> (not case sensitive) and the password <keybd user="admin">begin3</keybd> (typed in all lowercase).</para></section></section></chapter>

Page 46: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Form follows functionForm follows function

• Each format or layout for presentation can help us understand information – or not.

A table format (left), list format (middle), and comma-separated text file format (right) all organize the information. CSV files are meant to be read by machines, not people.

Page 47: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML is readable by people XML is readable by people and machinesand machines

• While no one really wants to read XML, humans can if they have to.

• Computers use parsers to read XML. Browsers can present XML with a default stylesheet, which makes iteasier for humans to read.

“Pretty printed” XML in IE 5 ->

XML in text editor without tabs and line breaks (above)

Page 48: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Where’s formatting come in?Where’s formatting come in?

• How the XML information is visually represented is applied in a separate process.– The appearance can vary widely in

the same media or in different media.

A variety of papercard decors (left);electronic solitaire (right)

Page 49: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Where’s formatting come in?Where’s formatting come in?

• The best use cases of XML “separate the information from the presentation”.– Even in HTML, when you see a <tr> containing

<td> inside a <table>, the tag is mostly a layout or presentation tag (creating a table), not an information tag. The browser will provide default presentation of the information in table layout.

– XML lets you be more descriptive about the meaning of information, but should not be used to be descriptive about its visual representation (i.e. tag as <important> rather than <bold>).

Page 50: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

• Writers write; designers format

XML in Publishing WorkflowsXML in Publishing Workflows

“Many writers who are new to structure are uncomfortable with the perceived lack of control over the final document. They have become accustomed to “tweaking” the final output to make it look right. Any implementation of a structured workflow must anticipate some resistance and perhaps even outright hostility from a minority of writers.This resistance seems misplaced, though. Instead of wrestling with formatting problems, writers can focus on content and organization—typically a better fit for writers’ skills and interests than desktop publishing. Working within a structure increases writer productivity and improves the quality and consistency of the final output.”

- Sarah O’Keefe, “Structured Authoring and XML” white paper,October 2002

Page 51: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XML in Publishing WorkflowsXML in Publishing Workflows

• XML can be an input to an authoring application, an output from one, and/or an interchange file format.

• Usually, writers do not work directly with XML.

• Templates are designed to enable structured authoring (input side) and styled content to users (output side). – Presentation specialists create the

templates for print and web, PDAs. – Programmers create the templates

for file interchange applications.

Page 52: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Presenting XSLPresenting XSL

• The “XML native” form of template writing is XSL (eXtensible Stylesheet Language). – Written in xml notation, is well-formed xml– Used to convert one xml to another xml, to

html, rtf, pdf, ascii text and other formats

• Most writers do not create XSL, rather they use application-based templates.

• It is useful to have a working knowledge of what XSL is and how it works if you deal with web programmers and database developers.

Page 53: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Making XSL to Transform XMLMaking XSL to Transform XML

• The most common use of XSL is to transform XML content into HTML. Secondly, XSL is used to to map between database tables and XML structures (change from one DTD or schema into another).– XSL can filter, sort and rearrange XML content,

as well as the determine font, color, size, position, etc. of the presentation formatting.

• An XSL file is called a stylesheet. The rules for transforming each part of the XML into its presentation format are called template rules.

Page 54: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. Hoskins Textenergy LLC

XML Under the Hood

Put concepts to workPut concepts to work

Do-it-yourself exercisesYou’ll need:

1. Sheets of colored and white paper2. Pencil (you’ll want to erase)3. XML model of the source content4. List of HTML elementsThat’s all you need to understand and work with

XSL: concept of the map between input and output, a writing tool, and your brain.

Page 55: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. Hoskins Textenergy LLC

XML Under the Hood

Put concepts to workPut concepts to work

Do-it-yourself exercises1. Find the XSL worksheet. Look at the XML

elements in the left column and the HTML elements in the right column. Some examples of element maps are already given for you. You will make a map for each of the rest of the elements that you want to output to the HTML page.

2. Use small sheets of paper (white and colored) to make a physical model of the structure mapping.

Page 56: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Do-it-yourself exerciseDo-it-yourself exercise

• Think about what template rules are used for. Look at your XML element structure. Ask yourself:

Which HTML element shall I use to present each of my XML elements to the user?

Do I want the every piece of content that is in the original XML file to output as HTML?If I need a list, shall it be bulleted or numbered?

Are some XML elements just containers that don’t map to a visible HTML output element?

Page 57: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

Do-it-yourself exerciseDo-it-yourself exercise

• The XML source file for the exercise is p.1 of the XSL worksheet packet.

• Review the template rule syntax in the worked examples on p.2.

• Write your XML to HTML mapping on p.3 of the XSL worksheet.– Follow the instructions and diagrams

on the 4th page to construct a physical model that shows how elements are sequenced and nested.

Page 58: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XSL Can Be as ComplexXSL Can Be as Complex as Necessary as Necessary

• XSL can produce a web page like this:– “Conditional text” can be developed with

attributes<xsl:template match="//para">

<xsl:choose><xsl:when test="@user='user'"><p><b>USER: </b> <xsl:apply-templates/></p></xsl:when><xsl:when test="@user='admin'"><p><b>ADMIN: </b><xsl:apply-templates/></p></xsl:when><xsl:when test="@user='all'"><p>ANYONE: <xsl:apply-templates/></p></xsl:when><xsl:otherwise>

<p><xsl:apply-templates/></p></xsl:otherwise>

</xsl:choose></xsl:template>

Page 59: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XSL Can Be as ComplexXSL Can Be as Complex as Necessary as Necessary

• XSL-FO (Formatting Objects) can be used to create entire page layouts with formatted text– inc. page size and margins, columns and gutters,

text formatting, table layouts, figure numbers, etc.– multiple page layouts for special cases (title page,

left and right hand pages, back matter, etc.)– best for reports, personalized materials built by

user selection, auto-generated responses– can be written out as PDF or RTF file formats– “not ready for prime time”, but keep your eyes

open

Page 60: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

XSL and CSS Can Work XSL and CSS Can Work TogetherTogether

• Cascading Style Sheets (CSS) files can be used to provide the text formatting (font, size, color, placement) of XML elements — while XSL is used to organize the content output (filter, sort, rearrange). – This “division of labor” keeps the XSL independent

of the HTML development, since the CSS can be changed as needed without re-coding the XSL.

– CSS is usually applied to whole pages, but XSL might be used only for content pulled from a database into dynamic web pages.

Page 61: © Copyright 2002, Dorothy J. Hoskins Textenergy LLC XML Under the Hood Why, Where and How to Use XML Target Audience: Technical Communicators Presented

© Copyright 2002, Dorothy J. HoskinsTextenergy LLC

XML Under the Hood

What we’ve covered todayWhat we’ve covered today

• Business reasons for using XML• How XML impacts writing and production

workflows• XML basics with hands-on exercise• XSL basics with hands-on exercise

A lot to think about, and more questions than answers? Stay tuned…

Textenergy is available (585) 750-3118www.resourx.com [email protected]