[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: Re-arranging an XML file
Hi Mike,
At 03:23 AM 1/22/2009, you wrote: Hi Wendell et. al, There are several potential reasons: 1. There are namespace declarations in your input that are qualifying your matches without your knowing it. Solution: read up on namespaces. (If your input has no namespaces defined, this won't be the case. Also, this tends to be all or nothing: if you have this problem, none of your templates will match properly.) 2. There is another template somewhere that is overriding this one, without your knowing it. Solution: understand template matching and the rules for determining template priority when two or more templates match. 3. The nodes that this template is intended to match are never being processed, so there is nothing to match. Solution: examine your template traversal, especially in templates matching ancestors of this node (assuming you are doing an orthodox top-down traversal), and make sure the nodes matching this template are being processed. There are probably other reasons I can't think of at the moment. The short version is, we can't know without seeing a sample of your data and a complete stylesheet that reproduces the problem -- preferably a reduced instance of each. Frequently, developers find that in the process of creating reduced instances to duplicate a particular bug, they discover the reason for the bug. This is a basic and very useful debugging method in XSLT, especially when things get complex. Absent this additional information, I've tried to offer "capsule diagnoses" to suggest to you where to look -- in keeping with our earlier recommendation that you complement this list by reading up in other resources, especially those that offer a comprehensive description of the XSLT processing model. Chances are, if you did post minimal examples showing us the entire problem, we'd have to explain the processing model to you in order to explain what's going on. You can leapfrog this entire process by reading up on the processing model yourself. By "processing model" I mean: What are XSLT's inputs and outputs (tree of nodes, not tags-and-text) What are templates (I like to call this the Yin of XSLT) What does apply-templates do (the Yang of XSLT) What does it mean for a template to match a node (Yin meets Yang) What happens if no template in your stylesheet matches a node being processed (every Yang has a Yin) After you initiate yourself into this mystery-that-is-not-a-secret, posts to the list to say "this is so cool" would be very welcome. Places to start, to complement books and tutorials: http://www.w3.org/TR/xslt http://www.dpawson.co.uk/xsl/sect2/N7654.html http://www.dpawson.co.uk/xsl/sect2/defaultrule.html http://www.dpawson.co.uk/xsl/sect2/pushpull.html You may find that some of this discussion is over your head at the moment, but that's okay. Like many simple things, XSLT is deep. Things will click if you persist. Cheers, Wendell
|
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
|