Michael Kay schrieb:
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.
Michael Ludwig
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--