Upload
sanjay-verma
View
216
Download
0
Embed Size (px)
Citation preview
8/3/2019 XML Xslt Overview
1/11
Copyright 2007 Rick Palmer | Online-eTraining.com
XML and XSLT Overview
XML and XSLT OverviewInstructor: Rick Palmer, SCWCD
8/3/2019 XML Xslt Overview
2/11
Copyright 2007 Rick Palmer | Online-eTraining.com
Topics Covered
XML
XSLT
8/3/2019 XML Xslt Overview
3/11
Copyright 2007 Rick Palmer | Online-eTraining.com
XML Introduction
XML = eXtensible Markup Language
Released Feb 1998 by W3C (World Wide Web Consortium)
Designed to separate data from formatting.
HTML defines both data and how a web browser should
display the data (formatting):
D eveloper: Bill Gates
XML only defines data (notice there are no HTMLformatting instructions like ,,, or ):
8/3/2019 XML Xslt Overview
4/11
Copyright 2007 Rick Palmer | Online-eTraining.com
XML Has Many Uses
Deployment descriptors (configuration files)
Transporting hierarchical data on the web (Ajax)
Platform-independent web services (SOAP)
Documentation that will be displayed in multipleformats (e.g. HTML, Help files, and PDF)
Integration with legacy data (XSLT)
Error loggingEtc Etc Etc
8/3/2019 XML Xslt Overview
5/11
Copyright 2007 Rick Palmer | Online-eTraining.com
XML Rules
XML must be Well-formed
Single top-level root element ()
Closing tags required, unlike HTML
No overlapping tags; nested is ok though:
Jeff Case sensitive ( is different than )
No invalid characters (, &)
No white space in element names
XML can be Valid, but its not required
XML is valid if it conforms to a DTD or XML Schema.
A DTD or XML Schema defines the XML elements and attributes that
should be contained in the XML document (not covered in this course)
8/3/2019 XML Xslt Overview
6/11
Copyright 2007 Rick Palmer | Online-eTraining.com
Namespaces
Some XML documents contain similarly-named tag
names (e.g. employees from two companies)
Namespaces uniquely identify similarly-named tags
Prefix + URI = unique tag name
Skip Chapman
$90,000
Doug Ashley
$60,000
Both elements and attributes can be qualified by anamespace identifier.
Namespaces are optional, but are recommended to ensureelement uniqueness inside xml documents.
8/3/2019 XML Xslt Overview
7/11Copyright 2007 Rick Palmer | Online-eTraining.com
XSLT Introduction
XSLT: Extensible Stylesheet Language for
Transformations XSLT converts XML to other document formats
Converts XML
Bill Gates
$670,000
To HTML, XML, CSV, PDF, etc..
Dear Bill Gates,
We regret to inform you that the Devdepartment
can no longer afford your $670,000 services.
8/3/2019 XML Xslt Overview
8/11Copyright 2007 Rick Palmer | Online-eTraining.com
XSLT Building Blocks
Root stylesheet element with namespacedesignator
Output type element (could also use "xml", "text", etc)
XSLT template elements
8/3/2019 XML Xslt Overview
9/11Copyright 2007 Rick Palmer | Online-eTraining.com
XSLT Building Blocks (cont.)
Applying XSLT templates recursively
Dear ,
We regret to inform you that the
department
can no longer afford your
services.
Selecting the value of an XML element
Selecting the value of an XML attribute
8/3/2019 XML Xslt Overview
10/11Copyright 2007 Rick Palmer | Online-eTraining.com
XSLT Transformation with IE
Internet Explorer includes its own XSLT processing
engine.
Include an xml-stylesheet directive at the top of the XML
document that points to the stylesheet:
Bill Gates
$670,000
Open the xml file in the browser to transform it to HTML
8/3/2019 XML Xslt Overview
11/11Copyright 2007 Rick Palmer | Online-eTraining.com
Resources
Java Web Services Tutorial:http://java.sun.com/webservices/docs/1.6/tutorial/doc/
Apache XML Project: http://xml.apache.org/
Java Guru: http://www.jguru.com/
Java World: http://www.javaworld.com/
MSDN XSLT Reference:http://msdn.microsoft.com/library/en-us/xmlsdk/html/xmrefxsltrefer
http://java.sun.com/webservices/docs/1.6/tutorial/doc/http://java.sun.com/webservices/docs/ea2/tutorial/index.htmlhttp://msdn.microsoft.com/library/en-us/xmlsdk/html/xmrefxsltreference.asphttp://msdn.microsoft.com/library/en-us/xmlsdk/html/xmrefxsltreference.asphttp://www.javaworld.com/http://www.jguru.com/http://xml.apache.org/http://java.sun.com/webservices/docs/ea2/tutorial/index.htmlhttp://java.sun.com/webservices/docs/1.6/tutorial/doc/