Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


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

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


You Too Can Transform Your <body> - Page 7

October 28, 2002

Now we've made sure that transformations will actually happen, we begin defining the transformations themselves. Further down the stylesheet are some lines that perform a template transformation on the <body> element of dinosaur_1.xml:

<xsl:template match="body">

<body>

<table style="border: solid thin black">

<tr>

<td><a href="mammoth.html">Visit the Mammoth zone!</a> - </td>

<td><a href="play.html">Play Pteranodon Poker</a></td>

</tr>

</table>

<xsl:apply-templates />

<hr/>

Copyright 2002 DinosaurOrg.

</body>

</xsl:template>

The first line of this section tells the XSLT processor to search through the XML document until it finds the opening tag of a <body> element, and then perform a transformation on the contents of this <body> element (everything from <body> to </body>). It's called xsl:template because its content defines a template for how to transform a <body> element.

The next seven lines are the start of this <body> element template. These lines of HTML are added in to the transformed page before the content of the original <body> element. The template does not do anything with the matched <body> tag itself, and so we insert a <body> tag ourselves in the template.

The start of dinosaur_1.xml is transformed from

<body>

...

to

<body>

<table style="border: solid thin black">

<tr>

<td><a href="mammoth.html">Visit the Mammoth zone!</a> - </td>

<td><a href="play.html">Play Pteranodon Poker</a></td>

</tr>

</table>

...

Our header is successfully added!


About the Stylesheet - Page 6
Practical XML for the Web
Transformation Without Change - Page 8


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




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, & Permissions, Privacy Policy.

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