Using XML for Documents - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

Using XML for Documents

Description:

Tools can ease the pain of learning new language (XMLSpy Stylesheet Designer) ... a document is requested, program checks security again. Some sections may be ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 36
Provided by: OAG78
Category:

less

Transcript and Presenter's Notes

Title: Using XML for Documents


1
Using XML for Documents
  • By John Baird
  • October 24, 2003

2
Overview 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

3
XML 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

4
ltdocument 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
5
Why use XML for Documents?
6
The 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)
12
Different 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.
13
Reasons 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
14
First Step Decide on a Schema.
15
What 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

16
ltxsschema 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 . . .
17
Developing 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

18
Tools such as XMLSpy (above) can assist in this
process.
19
XSLT 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

20
Sample 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
21
Developing 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.

22
Delivery 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

23
Options for Using XSLT to Deliver Content
Web Server
Web Browser
XML file
XML file
1
XSLT file
XSLT file
HTML
24
Options for Using XSLT to Deliver Content
Web Server
Web Browser
XML file
XML file
1
XSLT file
XSLT file
2
HTML
HTML
25
Options 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
26
OAG 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)
30
Document 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

31
Relationships 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
32
File 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.

33
Document Development
  • Development vs. Production
  • Directory structure
  • Platform differences
  • (Windows vs. Unix(case sensitive) )

34
Challenges 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)

35
Thank you
  • (for your attention.)
Write a Comment
User Comments (0)
About PowerShow.com