Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
 Discussion Forums
 HTML, XML, JavaScript...
 Software Reviews
 Editors,Others...
 Top100
 JavaScript Tutorials, ...
 Tutorials
 ASP, CSS, Databases...
 Discussion List
 FAQ, Roundup, Configure ...
 Authoring
 HTML, JavaScript, CSS...
 Design
 Layout, Navigation,...
 Graphics
 Tools, Colors, Images...
 Software
 Browsers, Editors, XML...
 Internet
 Domains, E-Commerce, ...
 WDVL Resources
  Intermdiate, Tutorials,...
 WDVL
 Discussion Lists, Top 100,...
 Technology Jobs


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Top 10 Articles
  1. Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
  2. JavaScript Tutorial for Programmers
  3. Design
  4. JavaScript Tutorial for Programmers - Objects
  5. JavaScript Tutorial for Programmers - JavaScript Grammar
  6. JavaScript Tutorial for Programmers - Versions of JavaScript
  7. Cascading Style Sheets
  8. JavaScript Tutorial for Programmers - Embedding JavaScript
  9. JavaScript Tutorial for Programmers - Functions
  10. Authoring JavaScript
Domain Name Lookup
Search to find the availability of a domain name. Just enter the complete domain name with extension (.com, .net, .edu)

Using XSL Transformations

October 30, 2000

In this exercise, you are going to get a taste of things to come. Specifically, you are going to use the World Wide Web's new XSL Transformation technology to convert an XML document into two different presentations.

1. Run your text editor and type in the following:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title>Film Library:<xsl:value-of
	select="filmlibrary/name"/></title>
</head>
<body>
<table border="2">
<tr>
<td>Title</td>
<td>Director</td>
<td>Year</td>
<td>Genre</td>
</tr>
<xsl:for-each select="filmlibrary/movie">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="credits/director"/></td>
<td><xsl:value-of select="year"/></td>
<td><xsl:value-of select="genre"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
[Note: The 6th and 7th line above are one line They were split for formatting purposes]

Save the file as movie1.xsl.

Create a new document in your text editor and type in the following:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="movie1.xsl"?>
<filmlibrary>
<name>Classic Films</name>
<movie>
<title>Beauty and the Beast</title>
<genre>Fantasy</genre>
<country>France</country>
<language>French</language>
<year>1946</year>
<length>90 Min.</length>
<filmtype>BW</filmtype>
<credits>
<director>Jean Cocteau</director>
<producer>Andre Paulve</producer>
<writer>Jean Cocteau</writer>
<story>Mme Leprince de Beaumont</story>
<cinematography>Henri Alekan</cinematography>
</credits>
<plot>Beauty lives in a cottage with her father and
her two wicked sisters. Once day her father comes
upon a strange mansion with an ugly sorcerer named
Beast.
</plot>
</movie>
<movie>
<title>The Bicycle Thief</title>
<genre>Social Drama</genre>
<country>Italy</country>
<language>Italian</language>
<year>1948</year>
<length>90 Min.</length>
<filmtype>BW</filmtype>
<credits>
<director>Vittorio de Sica</director>
<producer>Vittorio de Sica</producer>
<writer>Vittorio de Sica</writer>
<story>Gennarino Bartolini</story>
<cinematography>Carlo Montuori</cinematography>
</credits>
<plot>Told through the eyes of a young boy
named Bruno, <title>The Bicycle Thief</title> is the
story of his father"s struggle to provide for his family
in Rome following World War II.
</plot>
</movie>
</filmlibrary>

Save the file as movie1.xml. Run the file in Microsoft Internet Explorer. You should see something like this: Example 12

Run your text editor and type in the following:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title>Film Library:<xsl:value-of
	select="filmlibrary/name"/></title>
</head>
<body>
<xsl:for-each select="filmlibrary/movie">
<h1 style="text-align: center">
<xsl:value-of select="title"/>
</h1>
<h2 style="text-align: center">
<xsl:value-of select="year"/>
<xsl:value-of select="credits/director"/>
</h2>
<p>
<xsl:value-of select="genre"/>.<xsl:value-of select="plot"/>
</p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
[Note: The 6th and 7th line above are one line They were split for formatting purposes]

Save the file as movie2.xsl.

Load the movie1.xml file into your text editor and make href point to the second version of the XSL style sheet:

	<?xml-stylesheet type="text/xsl" href="movie2.xsl"?>
Save the file as movie2.xml. Run the file in Microsoft Internet Explorer. You should see something like this: Example 13

Strategies for Handling Media Types
Beginning XHTML
How It Works


Up to => Home / Authoring / Languages / XML / BeginningXHTML




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers