[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Compound filter in for-each
Wendell Thank you so much for this broader advice - I very much appreciate you taking the trouble. I have worked with XSLT before but very much on an intermittent and ad-hoc basis, to solve particular immediate problems. And as you suggest, that has involved guesswork, borrowing and adapting code where I can find it, searching on the Web and asking questions of this list. I have done some reading, notably the introductory chapters of Michael Kay's XSLT 1.0 Programmer's Reference book a few years ago, and more recently his XSLT 2.0 update. I've also looked at some basic tutorials on the Web. I have found the concepts difficult to grasp (again, as you suggest, I'm more familiar with procedural languages) though I had thought some of it was falling into place. Its clear I need to study some more, and in particular look at XPath in depth. I am keen to become proficient (I find the approach fascinating) so thanks again for the advice and encouragement. Best wishes Alan Alan Hale Uwch Botanegydd ag Ymgynghorydd Is-blanhigion/Senior Botanist and Advisor on Lower Plants Cyngor Cefn Gwlad Cymru/Countryside Council for Wales Plas Gogerddan Aberystwyth Cymru/Wales SY23 3EE Tel. 01970 821101 (Dysgwr) >>> Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> 15:03 25 March 2009 >>> Alan, You are certainly welcome to the help. Considering your posts, I also think you would be well served by a good introductory treatment or tutorial. Not only are you still guessing when it comes to the XPath, but also it appears that your code is not yet taking advantage of the XSLT processing model, which is characterized by a general preference for template matching over explicit conditionals using xsl:choose or xsl:if. This isn't surprising if you're new to the language. Template matching requires a rather different kind of thinking from the imperative statements typical of procedural languages, although it is just as predictable and logical once you get the hang of it. Related to this, it appears that a good part of the reason why you aren't using a template matching approach is that you are faced with a kind of problem (essentially, flattening a very regular structure) that doesn't need it and wouldn't necessarily even take advantage of it. In a sense, the problem you are solving hasn't actually demanded that you "take the plunge". While XSLT is perfectly able to do what you're doing with it, it doesn't have to do it in a particularly XSLT-like way. Other kinds of problems, on the other hand.... Competency in XSLT really requires at least two things: proficiency (if not absolute mastery) of XPath syntax, and a certain comfort level with the related concept of context (which you've now taken in) and the applying and matching of templates that is at the heart of its processing model. This is the case even (or especially) when working with problems that are outside the core problem domain of straightforward conversions of semi-structured input. (As noted, your input looks very structured.) I bet if you take a few hours to study the language on its own (on the net or with a good book), if only as an academic exercise and out of curiosity, you'll be much better able to move forward and learn more quickly. Questions you might ask yourself are: What are templates and how to they work? What sorts of transformation problems take advantage of templates? What does the basic grammar of XPath look like? Put this together with what you've recently learned about processing context, and you'll be well on your way. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
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
|