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)

XSLT and Alternatives (Con't) - Page 3

October 19, 2001

Dealing with an input tree instead of an input document also gives you an important advantage that XML developers get from DOM trees: at any given point in your pro-cessing, the whole document is available to you. If your program sees a word in the document’s first paragraph that’s defined in the glossary at the end, it can go to the glossary to pull out the term’s definition. Using an event-driven model such as the Simple API for XML (SAX) to process a document instead of a tree-based model like XSLT uses, your program would process each XML element as it read the element in. While doing this, if you want to check some information near the end of your docu-ment when reading an element in the beginning, you need to create and keep track of data structures in memory, which makes your processing more complicated.

TIP When a discussion of XSLT issues talks about a source tree and a result tree, you can think of these trees as temporary representations of your input and output documents.

Not all nodes of a document tree are element nodes. A diagram of the tree that would represent this document

<?xml-stylesheet href="article.xsl" type="text/xsl"?>
<article>
<!-- here is a comment -->
<title author="bd">Sample Document</title>
<para>My 1st paragraph.</para>
<para>My 2nd paragraph.</para>
</article>

shows that there are nodes for elements, attributes, processing instructions, com-ments, and the text within elements. (There are also nodes for namespaces, but this document has no namespace nodes.)

Figure 1.4 A document tree with several different node types

It’s easy to match up the parts of the tree with the parts of the corresponding docu-ment, except that it might appear that the document has too many "text" nodes. The tree diagram shows text between the comment and the title element, and text between the two para elements; where is this text in the document? You can’t see this text, but it’s there: it’s the carriage returns that separate those components of the document. If the two para elements had been written as one line, like this,

<para>My 1st paragraph.</para>
<para>My 2nd paragraph.</para>

[The lines above are one line. They have been split for formatting purposes.]

no text node would exist between those two elements, and you wouldn’t see a text node between them in the tree diagram. (See section 6.11, "Whitespace: preserving and controlling," page 229 for more on this.)

You also might wonder why, if article is the root element of the document, it’s not the root node of the tree. According to XSLT’s view of the data (its "data model"), the root element is a child of a predefined root node of the tree (shown as a slash in the diagram) because it may have siblings. In the example above, the process-ing instruction is not inside the article element, but before it. It is therefore not a child of the article element, but its sibling. Representing both the processing instruction and the article element as the children of the tree’s root node makes this possible.

XSLT and Alternatives - Page 2
XSLT Quickly
A Simple XSLT Stylesheet - Page 4


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




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