[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Getting the first p inside a div
At 12:25 PM 8/19/2008, you wrote:
<xsl:template match="note//p"> Interestingly, it's also an exception to the general principle that more templates are usually better. In this case, I think that's a consequence of how the rules limit what expressions can be used as match patterns (so, for example, the pattern "note/descendant::p[1]" is illegal), plus the fact that in this case the special treatment isn't exclusive of the general treatment (both sorts of p become p[@class='note_p']). As an aside -- this code assumes that you'll never have notes nested inside your notes. If you do, amend the test to look at ancestor::note[1]/descendant::p[1] (and maybe watch out for more edge cases). 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
|