Subject: Re: [xsl] Same name Elements in more than one node From: Mike Ferrando <mikeferrando@xxxxxxxxx> Date: Wed, 26 Dec 2001 12:43:40 -0800 (PST) |
--- Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> wrote: > Ugh! you'll find the "solution" scales poorly and is very brittle. > > Is there any reason *not* to use templates? Wendell and friends, Yes, templates seem to me to be the answer. However, I do have some reservations in using them. Mostly my problems are the result of ignorance. I have tried to educate myself in their usage from Michael Kay's book (1st edition), but I have been unable to untangle some complexities in their usage. 1. Calling them "select" or "match"? Initally I have a problem with how they are called. Is the name that they are referred to have to be the same as the element they refer to? Or are they used like Labels (each having a unique name)? I am used to assigning functions based on conditions using "call" and "goto" followed by the label name. These take you out of the main loop so that a function can be completed at a certain step and then return you to your main loop again. However, I find it very unclear as to what my template will be named and what attribute will be used. The examples seem to run the gamit as full paths as well as names that are derived from the elements they are processing. 2. Node addressed. I find it very unclear as to when I call up my template how it will be effected by the node I am currently functioning in. If I am let's say in an <xsl:for-each select="//C02"> and I call up a template that has to do with the <C03> child, do I assume that I must give the entire path to the element beginning from //C02? I find this all the more unclear when I have same name elements in parent and child nodes. 3. Order of templates I also find it unclear as to how the templates will appear in my output. Is there are certain order that templates are executed? If I just type <xsl:apply-templates> in my stylesheet, is the order of their execution have a specific default (top down, etc.)? Finally, I would love to see a protocol for delimiters in expressions. What I am referring to is in the expression: <xsl:value-of select=""/> If I write an expression in the "" should my order be 1. "" (i.e., select="Expression") 2. [] (i.e., select="[Expression]") 3. () (i.e., select="[(Expression)]") 4. '' (i.e., select="[('Expression')]") 5. {} (i.e., select="[('{Expression}')]") I would very much like to see something like this but I have been unable to find it so far (my novice experience I grant). It becomes really hairy when you want to designate a string in the middle of all this. I assume that a string must have '' around it, but what if you are already at that level in your expression? Is there another delimiter that can be used? I end up writing stuff like this: <xsl:value-of select="//PERSNAME[@ENCODINGANALOG='100$a'][2][not(.=preceding::PERSNAME)]"/> So is there a limit as to how many [] the parser will read and process? It seems to me that some of these have specific uses such as {}. Also, an NOT list would be nice as well. I guess this is something you learn in programming school. I admit I am a haack, so if I could trouble someone to spell it out for me. I would really appreciate it. Thanks for your patience. Mike F. __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Same name Elements in mor, Wendell Piez | Thread | Re: [xsl] Same name Elements in mor, Wendell Piez |
Re: [xsl] text::trim(), Wendell Piez | Date | Re: [xsl] Same name Elements in mor, Wendell Piez |
Month |