2. XML
XML Namespaces
HTML
XHTML
XSL
XPath
XSLT : What it do ? How it do it?
XSLT :Demo - example
Q&A
2 HP Restricted HP Restricted 1/1/2013 2
3. XML stands for eXtensible Markup Language
eXtensible which means that tags are not
predefined Extensible means that there is no
fixed tag set (like in HTML)
Markup Language : is a set of markup tags.
XML was created to structure, store, and
transport information.
XML is designed to be self-descriptive
4. A "Well Formed" XML document has correct
XML syntax.
The syntax rules are :
XML documents must have a root element
XML elements must have a closing tag
XML tags are case sensitive
XML elements must be properly nested
XML attribute values must be quoted
5. Name Conflicts
In XML, element names are defined by the developer. This often
results in a conflict when trying to mix XML documents from
different XML applications.
This XML carries HTML table information:
<table>
<tr>
<td>Apples</td>
<td>Bananas</td>
</tr>
</table>
This XML carries information about a table (a piece of furniture):
<table>
<name>African Coffee Table</name>
<width>80</width>
<length>120</length>
</table>
8. Defining a default namespace for an element
saves us from using prefixes in all the child
elements. It has the following syntax:
xmlns="namespaceURI“
This XML carries information about a piece of
furniture:
<table xmlns="http://www.w3.org/TR/html4/">
<tr>
<td>Apples</td>
<td>Bananas</td>
</tr>
</table>
9. HTML stands
for Hyper Text Markup Language
HTML is not a programming language, it is
a markup language
The tags of HTML is predefined markup tags
10. XHTML stands for EXtensible HyperText
Markup Language
Well formed HTML
11. XSL stands for
EXtensible Stylesheet Language.
XSL = Style Sheets for XML
XSL describes how the XML
document should be displayed!
12. Styling is both about transforming and
formatting information. When the World Wide Web
Consortium (W3C) made their first XSL Working Draft,
it contained the language syntax for both
transforming and formatting XML documents.
Later, the Working Group at W3C split the original
draft into separate Recommendations:
* XSLT, a language for transforming XML documents
* XSL-FO, a language for formatting XML documents
* XPath, a language for navigating in XML documents
13. XPath, the XML Path Language, is a query
language for selecting nodes from
an XML document.
The XPath language is based on a tree
representation of the XML document, and
provides the ability to navigate around the
tree, selecting nodes by a variety of criteria
14. XSLT is used to transform an XML document
into another XML document, or another type
of document that is recognized by a browser,
like HTML and XHTML. Normally XSLT does
this by transforming each XML element into an
(X)HTML element.
15. In the transformation process, XSLT uses
XPath to define parts of the source document
that should match one or more predefined
templates. When a match is found, XSLT will
transform the matching part of the source
document into the result document.
18. The <xsl:template> Element
The <xsl:template> element is used to build
templates.
The match attribute is used to associate a
template with an XML element. The match
attribute can also be used to define a template for
the entire XML document. The value of the match
attribute is an XPath expression (i.e. match="/"
defines the whole document).
<xsl:template match="/">
----------
</ xsl:template >
Editor's Notes
A "Valid" XML document is a "Well Formed" XML document, which also conforms to the rules of a Document Type Definition (DTD):The purpose of a DTD is to define the structure of an XML document. It defines the structure with a list of legal elements:
XHTML is almost identical to HTML 4.01XHTML is a stricter and cleaner version of HTMLXHTML is HTML defined as an XML applicationXHTML is a W3C Recommendation of January 2000.XHTML is supported by all major browsers.XHTML elements must be properly nestedXHTML elements must always be closedXHTML elements must be in lowercaseXHTML documents must have one root element
An XSL style sheet is, like with CSS, a file that describes how to display an XML document of a given type.
In addition, XPath may be used to compute values (e.g., strings, numbers, or Boolean values) from the content of an XML document
XSLT :Originally intended to perform complex styling operations, like the generation of tables of contents and indexes, it is now used as a general purpose XML processing language. XSLT is thus widely used for purposes other than XSL, like generating HTML web pages from XML data.
An XSL style sheet consists of one or more set of rules that are called templates.A template contains rules to apply when a specified node is matched