[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] push v. pull (was Never use for-each)
I was hoping someone else would pick up on this thread, because as a naive xsl user it brings up an issue I haven't seen answers to (I have only seen Michael Kay's book, and some introductory sections in general xml books which say something like 'here's the literal result element style; you can do more, but that's for advanced people... Maybe there are obvious other books people can recommend for style/architecture with xslt, rather than syntax? Michael's book presents the alternatives, more than making recommendations.) On Mon, 29 Oct 2001, Joerg Pietschmann wrote: > > The "Literal Result Element as Stylesheet" > http://www.w3.org/TR/xslt.html#result-element-stylesheet > has been tailored for this, but people, not aware of this > possibility, also often use a single template matching "/" > or the document element and do all the work there. > It is so easy > because you basically see the structure of the resulting HTML > document already in the style sheet. So this style is one that fits well with the 'designers shouldn't have to know coding in depth; presentation should be separate from code' approach. > > Unfortunately, if the input becomes more complex, the pull > approach quickly becomes messy and unmaintainable as lots of > constructs are duplicated. When this happens, newbies (and > even not-quite-as-green XSLT programmers), having learned > "pull" first, have a hard time to switch to the template driven > "push" style, mainly because the structure of the resulting > document is no longer easy to spot. That's also the main reason > why many people who started learning XSLT with the "push" > approach have diffucilties in the beginning and think XSLT is > overly complex and hard to learn. There are other issues i > don't want to comment on. > So using the 'push' approach I discovered that I could move amounts of logic out of server-side programs into templates, and make those templates relatively independent of the xml I was processing. I could do things in one line with xpath that would have taken whole subroutines before. The end result is that now my html output is completely entangled with the xsl code. The html structure is hard to follow without actually walking through the code. Changing the design has become something that only someone who knows the code well can do easily (and even then I've found it is very easy to write very frqgile xsl :-(. This is something I was always told was bad. So I guess I'm doing it wrong. How do people use a push style and make it easy for designers to make changes? Or is this the wrong question? Graham XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|