[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Traversing a XML tree multiple times

Subject: Re: Traversing a XML tree multiple times
From: "Paul Tyson" <paul@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 30 Sep 2001 12:13:34 -0700
traverse xml tree
Jeroen:

The answer is probably "yes", but without more specific information no one
could really say for certain.

You can "traverse" the document (or any portion of it) as many times as
needed simply by applying (or calling) templates.   Remember, though, that
the entire document tree is accessible "all the time" when the document is
being processed--no matter which particular element or attribute template is
currently active.  So, it is easy to select unique transformation of any
node based on characteristics of any other node, without explicitly
"traversing" the document repeatedly.  You refer to other nodes in the
document with XPath expressions.

There are many different techniques of conditional transformation--the best
one for your application depends mostly on the particular structure of your
source documents, and the characteristics that must be selected to
conditionalize each stage of transformation.

If you are not familiar with functional programming techniques, you may be
frustrated with the variable-binding and -referencing capabilities of XSLT.
For instance, you can't set a variable value in one node, and then refer to
the variable to get that value while processing another node.  Likewise, you
can't set a variable value during one "traversal", and then use it during a
subsequent "traversal".  (You can, however, bind a top-level variable to the
result of applying a template.  Then that variable-binding is visible within
all templates in the stylesheet.)

XSLT is most effective for problems that are conceptualized and stated as
tree transformation problems.  It can be terribly frustrating (and may not
be appropriate) for problems that only involve a sequence of imperative
commands on a serialized data set (which is what you get when you simply
"traverse" a document tree).

I'm sure you would get many suggestions from this list if you posted some
more specific information about your problem.

Good luck,
Paul Tyson
Precision Documents  http://precisiondocuments.com

----- Original Message -----
From: "Jeroen Benckhuijsen" <j.f.benckhuijsen@xxxxxxx>
To: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Sunday, September 30, 2001 9:54 AM
Subject:  Traversing a XML tree multiple times


> Hi,
>
> I've been playing around with XML and XSLT lately and i really don't
> have any clue how to solve this problem. I want to transform an XML
> document using XSL. However i nedd to traverse the tree multiple times.
> The first time i want to make a selection, the second a different
> selection (based on the results of the first selection), etc. Is this
> possible in 1 xsl document?
>
> TIA
>
> --
> Jeroen Benckhuijsen
>
> Software Engineer
> Phoenix Software
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.