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


The Root Rule

The root element defines the HTML elements that control the overall structure of the document. The elements that can be defined using <root> are the HTML, HEAD, and BODY elements, and any associated elements they may contain.

To demonstrate the root rule, I added the HTML, HEAD, and BODY elements to the document, and included the title for the document as part of the head. The XSL for this rule is defined in the following block:

 <rule>
  <root/>
   <HTML>
     <HEAD>
	<TITLE>XML
	</TITLE>
     </HEAD>
     <BODY>
	<children/>
     </BODY>
   </HTML>
 </rule>

Once processed, the generated HTML from this XSL defines the overall structure of the document, as you can see with the generated output. Check out the source by using the "View Source" option defined for the browser. Notice that the document now has a title, a header, and a body, and is delimited by opening and closing HTML tags.

Not only can the HEAD, BODY, and HTML elements be defined within the root, but scripting blocks can also be included within a root element. For example, to add a scripting block to the root requires that a CDATA block be used to enclose the script. CDATA is an XML language specification to define content that is not to be processed, but to be passed through to the generated output as is. The following code demonstrates adding scripting to an XSL file:

 <rule>
  <root/>
   <HTML>
     <HEAD>
	<TITLE>XML
	</TITLE>
	<SCRIPT language="Javascript"><![CDATA[
	     function test() {
			alert("hello");
		}
	]]></SCRIPT>
     </HEAD>
     <BODY onload="test()">
	<children/>
     </BODY>
   </HTML>
 </rule>

This generated example will display a message with "hello" when the page loads.

Our discussion to this point has focused on matching patterns. With XSL, the absence of a pattern is just as telling as the pattern itself, as this implies a wildcard, discussed next.

Adding Parental Patterns to the XSL Rule
Add a little style to your XML document with XSL - a Working Example
Wildcards


Up to => Home / Authoring / Languages / XSL / Example




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