Subject: Re: [xsl] returning nodes which have a specific child From: Michael Ludwig <mlu@xxxxxxxxxxxxx> Date: Thu, 02 Jul 2009 12:14:50 +0200 |
I would have given the rules explicit priorities of 1, 2, and 3 respectively to make this more readable.
I agree this can help to make it more readable. But it depends on the reader. I rarely assign priorities, because when adding more rules, I then have to remember my hand-crafted priority matrix, which may be different each time around, whereas the default priorities are stable.
Michael has also taken a short-cut in that Rule 1 is a very commonly used "default rule" called the identity template, so he has re-used it; but in your case it's never used for element nodes, so it could be replaced by the simpler rule
<xsl:template match="@*"> <xsl:copy/> </xsl:template>
That's true. But I like to see an identity template around, as a backup and safety net, so to say, against changes I may make. I think the identity template would have been a useful default rule.
http://markmail.org/message/xmqxvbxdzewbeyhu http://markmail.org/message/o4ceperr4svpffr5
(I'm not sure why rule 3 is processing the attributes of an element and rule 2 isn't, but I didn't study your original problem.)
In rule 2, I only want to keep the recursion alive, deilberately losing all attributes and non-element children, so I don't <apply-templates> to them.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] returning nodes which hav, Michael Kay | Thread | RE: [xsl] returning nodes which hav, Michael Kay |
RE: [xsl] returning nodes which hav, Michael Kay | Date | RE: [xsl] returning nodes which hav, Michael Kay |
Month |