Title: Using XML for Documents
1Using XML for Documents
- By John Baird
- October 24, 2003
2Overview of Presentation
- Why Use XML for Documents?
- Developing an XML Schema
- Developing an XSLT Style Sheet
- Delivery Options
- Document Development
- Challenges of Using XML for Documents
3XML Basics
- Tag delimited content
- Tag vocabulary
- Hierarchical
- Self documenting
- Elements (what is between the tags)
- Attributes (what is within the tags)
- Conforms to XML rules Well Formed
4ltdocument Title"Customer Support Policy"
xmlnsxsi"http//www.w3.org/2001/XMLSchema-instan
ce" xsinoNamespaceSchemaLocation../OAG_Simple_D
oc.xsd"gt ltp heading"Overview"gt
lttextblockgtThe goal of the CSE Division is to
provide the best possible customer service. To
that end, we have have created the following
policies. lt/textblockgt lt/pgt ltp
heading"Customer Instructions"gt
lttextblockgtCustomers can contact the OAG CSE
Division during business hours by calling
345-6789. Please be ready with the following
information. lt/textblockgt
ltlistgt ltitemsgtYour Namelt/itemsgt ltitemsgtYour
SSNlt/itemsgt ltitemsgtYour Birth
Datelt/itemsgt ltitemsgtYour Case Numberlt/itemsgt
lt/listgt lt/pgt lt/documentgt
5Why use XML for Documents?
6The following are pages from our Intranet. They
reflect the fact that our organization is highly
departmental.
7(No Transcript)
8(No Transcript)
9(No Transcript)
10(No Transcript)
11(No Transcript)
12Different content may be OK for internal
employees using the Intranet. However, if we
want to provide good service to our customers,
they should see one consistent view.
13Reasons to Use XML for Documents
- Provide Customers with Consistent View of the
Content Using XSLT - Separate Content from Presentation
- Low risk way to get our feet wet with XML
Author/Owner
XML
Authoring Tool
Schema or DTD
Content
Web Designer
XSLT
Design Tool
Presentation
14First Step Decide on a Schema.
15What is an XML Schema?
- Defines the standard format of an XML file
- Tag vocabulary
- Valid attributes
- Hierarchy
- Could use Document Type Definition (DTD) instead
- XML that conforms to Schema (or DTD) Valid
- XML file can contain reference to schema
- Schema (.xsd file) is XML
16ltxsschema xmlnsxs"http//www.w3.org/2001/XMLSch
ema" elementFormDefault"qualified
attributeFormDefault"unqualified"gt ltxselement
name"document"gt ltxsannotationgt
ltxsdocumentationgtSimple OAG Documentlt/xsdocument
ationgt lt/xsannotationgt ltxscomplexTypegt ltxs
sequencegt ltxselement name"p"
maxOccurs"unbounded"gt ltxscomplexTypegt
ltxsallgt ltxselement name"textblock"
type"xsstring" minOccurs"0"/gt
ltxselement name"list" minOccurs"0"gt
ltxscomplexTypegt ltxssequencegt
ltxselement name"items" type"xsstring"
maxOccurs"unbounded"/gt lt/xssequencegt
lt/xscomplexTypegt . . .
17Developing a Schema
- Can either adopt an existing schema or develop
your own - Existing Schemas
- Docbook
- TEI (Text Encoding Initiative)
- DITA (Darwin Information Typing Architecture)
- Developing a schema is an iterative process
- Lots of trial and error
- Experiment with XML, XSD, and XSLT.
- Important to get schema into final format before
developing a bunch of documents
18Tools such as XMLSpy (above) can assist in this
process.
19XSLT Style Sheets (.xslt)
- Numerous ways to extract XML data for viewing or
for use by applications - Java, VB, C, C, etc.
- XSLT Style Sheets
- Generates HTML, WML, CHTML, and more
- Can convert XML to XML
- Need XLS-FO for PDF (Adobe Acrobat) files
- XSLT language is valid XML
20Sample XSLT Style Sheet
ltxslstylesheet version"1.0" xmlnsxsl"http//w
ww.w3.org/1999/XSL/Transform" xmlnsxs"http//ww
w.w3.org/2001/XMLSchema"gt ltxsltemplate
match"/"gt lthtmlgt lthead/gt ltbodygt
ltxslfor-each select"document"gt
lttable border"0" width"100"gt ltxslif
test"position()1"gt ltxsltext
disable-output-escaping"yes"gtlttbodygtlt/xslt
extgt lt/xslifgt lttrgt lttd align"center"gt ltx
slfor-each select"_at_Title"gt ltspan
style"font-sizelarge"gt ltxslvalue-of
select"."/gt lt/spangt lt/xslfor-eachgt lt/
tdgt lt/trgt ltxslif test"position()last()"gt
ltxsltext disable-output-escaping"yes"gtlt/t
bodygtlt/xsltextgt lt/xslifgt
lt/tablegt o o o
21Developing XSL Stylesheet
- Tools can ease the pain of learning new language
(XMLSpy Stylesheet Designer) - Language is Recursive
- Look for balance between versatility and ease of
data entry.
22Delivery Options
- XSLT can be applied within browser
- XSLT can be applied ahead of time
- Can use program to merge XLST and XML to produce
HTML
23Options for Using XSLT to Deliver Content
Web Server
Web Browser
XML file
XML file
1
XSLT file
XSLT file
HTML
24Options for Using XSLT to Deliver Content
Web Server
Web Browser
XML file
XML file
1
XSLT file
XSLT file
2
HTML
HTML
25Options for Using XSLT to Deliver Content
Web Server
Web Browser
XML file
XML file
1
XSLT file
XSLT file
2
HTML
HTML
3
XML file
XSLT file
26OAG Portal Mechanism to Deliver User Guides
Portal
3. When a document is requested, program checks
security again. Some sections may be omitted.
Security Database
XML file(s)
Java Code
1. Program reads database to determine what the
user can view.
XSLT file
Java Code
4. Program processes XML using standard XSLT file
to produce HTML and delivers that to the user.
2. Program constructs index and opens new
instance of browser.
Browser
Document (HTML)
Index
27(No Transcript)
28(No Transcript)
29(No Transcript)
30Document Development
- How to get documents into XML format
- Service providers can do conversion
- (Similar to language translation services)
- Tools available to create and revise XML
- (e.g. XMLSpy, Authentic, Textpad, Xmetal, etc.)
- Forms or programs can be developed in-house
- Procedural Staffing Options
- Authors trained in XML and tools
- FTE position to convert documents to XML
31Relationships to Consider
XSD File (XML Schema)
References
Depends on
References
XSLT File (Stylesheet)
SPS File (XMLSpy file for Stylesheet Designer
Authentic View)
XML Document
Can Generate
References
References
32File Locations and References
- Files needed for Development
- XML files, XML schema, XSLT style sheets, and SPS
files (optional) - Locations
- Local Drive (requires duplicate copies)
- Network Drive (requires identical drive mapping
what about Production?) - XSD and XSLT References
- Can use relative references (e.g. ../ltfilenamegt)
- URL (http location needs to be accessible to all)
- SPS Reference
- Had to remove before migration to PROD.
33Document Development
- Development vs. Production
- Directory structure
- Platform differences
- (Windows vs. Unix(case sensitive) )
34Challenges of Using XML for Documents
- Consistency depends on more than just a standard
schema and style sheet. Standards for content are
also needed. - Authors tend to think of presentation as content.
- See Handouts
- Creating XML Documents
- Content Guidelines
- XML Schema (OAG_Docs.xsd)
-
35Thank you