[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: returning nodes which have a specific child

Subject: Re: returning nodes which have a specific child
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Thu, 02 Jul 2009 12:14:50 +0200
Re:  returning nodes which have a specific child
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.