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

Re: How Can I Reference previous XML in Subsequent It

Subject: Re: How Can I Reference previous XML in Subsequent Iterations?
From: "Chris M." <chris@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Apr 2007 13:52:34 -0400
Re:  How Can I Reference previous XML in Subsequent  It
Wow. Thanks for all the help!

I'll have to digest it a bit later on, but this sure beats the sound of crickets chirping I've had on other forums.

Someone posted in another thread that "XSLT is dead," but I think that it is really just not being explained/evangelized well enough (which is what is making XML in general such a tough sell). People like me, who have a solid background in computer science, aren't very common. I can hunt down information and sort through chaff, but your average Web designer can't do this as easily. It can take them years to build up a reference schema, so to speak, and XML/XSL is presented as a completely new "paradigm," with no connection to their known schema. As has been pointed out, the thinking needs to be different. XSLT starts with the assumption that the learner has a fairly solid understanding of XML first (especially namespaces -Excedrin Headache #2), which is a brick wall barrier to many people who would otherwise enthusiastically embrace the advantages of XSLT.

I'm no XSLT expert, but I have already developed a site that does automatic transforms for WML 1, WML 2 or XHTML, depending upon the user agent. When I show this to people who do regular Web sites, their jaws drop. They would LOVE to be able to do it. However, when I start explaining how I do it, they get all googly-eyed and start snoring.

The problem is to bring XML to the Proletariat. Not sure how this is best handled. W3schools has a fairly good tutorial, but even that is fairly light on the "big picture."

On Apr 18, 2007, at 12:22 PM, Abel Braaksma wrote:

Chris M. wrote:
Well, here we have a node-set, not the layout in the original XML. In this case, it is the same, and crucial to the output.

I found out the hard way that a sorted node-set is not iterated in the sorted order, but the order in the original predicate. I am also limited to using XPath 1.0 (the libxslt implementation used in PHP 5), so I miss out on some very nice XPath 2.0 functions).


No, you are not limited to XPath/XSLT 1.0. With PHP you can call anything from outside that language. Actually, that is what you are already doing (libxslt is written in C++, not in PHP). You can choose to use Saxon 8.9 or Gestalt, the first is in .NET and Java, the latter in Eiffel, but both can be called from PHP with only a little trouble.


Though your current problem is fairly easily solvable by XSLT 1.0 alone (but you may quickly find it limited if you start to use if more).

Everything, both in XSLT 1.0 and 2.0 is "iterated" in document order. If you want to sort something, you can do so in XSLT with the xsl:sort instruction (which sorts the result, not the input). Of course you can sort the content of your document before it gets to XSLT, but if all you need is to sort the output, you can stick to XSLT alone. As a matter of fact, I have never seen a use case where I needed the order of the input different than the document order. Focus on the output, not the input (it is a declarative language, remember).

Cheers,
-- Abel


Chris Marshall
chris at getridofthiswholelongthingybecauseitstoconfusescrapers littlegreenviper dot com
http://www.cmarshall.net/


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.