Extensible Stylesheet Language Transformations - E-Commerce - Lecture Slides, Slides of Fundamentals of E-Commerce

Students of Communication, study E-Commerce as an auxiliary subject. these are the key points discussed in these Lecture Slides of E-Commerce : Extensible Stylesheet Language Transformations, Based Language, Content Format, Transforming, Document, Style Sheets, Prsentation, Side Technology, Capable, Internet Explorer

Typology: Slides

2012/2013

Uploaded on 07/29/2013

sharad_984
sharad_984 🇮🇳

4.5

(13)

129 documents

1 / 26

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
XML and XSL
Transforming your XML documents with
eXtensible Stylesheet Language Transformations
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download Extensible Stylesheet Language Transformations - E-Commerce - Lecture Slides and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

XML and XSL Transforming your XML documents with eXtensible Stylesheet Language Transformations

XSL - Overview ^ XSL is the

eXtensible Stylesheet Language

^ XSL is an XML-based language, like WML; butwhere WML is a

content format

, XSL is a way to

to^ format content

^ The process of applying XSL to an XMLdocument is called

transforming the document

You transform it from one language--XML--toanother: HTML, or maybe WML, or text or who-knows-what; even to another XML language.  XSL is to XML as style sheets are to HTML; butXSL is actually much more powerful.

XSL - Overview ^ What’s it look like?^ 

Remember XML? This is a class about XML.  Sample XML:

Hello,

world!  And how it looks in IE 6:

XSL - Overview ^ We’re going to use XSL to give visual meaning tothose two new tags,

document

and

underlined

^ HTML defines a set of tags that specifyformatting rules;

,

, and the like allspecify visual formatting rules. ^ XSL allows us to define our own tags; just as means underline in HTML, we can make an tag of our own that will underlinethe XML content. ^ An XSL document defines a list of matchingsfrom a tag and its content to a templateexpansion of HTML (or other) text.

XSL - Example One ^ ...and here’s the result of applying it to the XML:

XSL - Example One ^ So how’d that work? ^ After I created the .xsl file, I added one line to the.xml file:^

^ When Internet Explorer loaded the XML file, itfound this XSL directive and loaded the XSL fileto find the formatting transformation. Then itapplied the XSL rules to the XML data, andtransformed the XML into HTML.

XSL - Templates and Nodes ^ A closer look at the XSL code:^ 

The standard XML header is followed by the

stylesheet

tag:

... ^ The stylesheet lays out a series of

template

tags:

... ... ^ Within each template, the XSL specifies the rules ofreplacement. For example,

replaces all instances of the “underlined” tag with a bit ofHTML formatting--the tags--wrapped around the content.

XSL - Templates and Nodes ^ The XSL template tags^ ^ 

As each node of the source XML is processed, its tag ismatched against the list of ’s in the XSL. The XSLprocessor searches for a tage whose

match

field

matches the XML tag name. If it finds one, it replaces theXML tag with the content specified in the body of the tag.  match=“/”

will match the root node of the document.

^ The tag is XSL for “recurse within this tag”.When the XSL processor encounters this, it calls itself on thecontent within the current node.

XSL - Example Two ^ The XSL code:^

Degree sought :

XSL - Example Two ^ And the resulting transformed document:

XSL - Node values and attributes ^ For example, if we add

28July1973 to the end of the content and

Birth

date

:^

,

to the XSL, we get

Birth date :

July28, 1973

at the end of the output.

XSL - Node values and attributes ^ Perhaps more interesting, the

tag has a

select=“...”

attribute too.

^ By specifying what to apply the template recursion to, we canactually

change the structure of the document

Here instead of mindlessly displaying the content inside the tag in the order it’s entered, we’re displaying it inthe order specified. We’re changing the actual tree structureof the XML document as we transform it.

XSL - Loops ^ XSL supports looping over all the similiar childnodes of a tag with the

element.

^ This is handy for laying out tables or lists. For example, youcan open your tag and then fill in all the rows. ^ The

select

attribute of the

for-each

tag acts as a search.

You can specify the nodes you want to enumerate over, andthey’ll be processed in the order in which they appear. Youspecify the nodes with an XPath path.  Again,

this can change the fundamental structure of the document

XSL - Example Four ^ For example, this code will create a table of allthe tags: