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

Re: Getting the first p inside a div

Subject: Re: Getting the first p inside a div
From: Walter Lee Davis <waltd@xxxxxxxxxxxx>
Date: Tue, 19 Aug 2008 12:25:13 -0400
Re:  Getting the first p inside a div
Thanks very much!

On Aug 19, 2008, at 12:02 PM, Wendell Piez wrote:

Something like this:

<xsl:template match="note//p">
<p class="note_p">
<xsl:if test="generate-id() = generate-id(ancestor::note/ descendant::p[1])">
<xsl:apply-templates select="ancestor::note/label"/>
</xsl:if>
<xsl:apply-templates/>
</p>
</xsl:template>


What this does:

* Collapse the templates together for all p elements inside note, rather than splitting a template out for the first p. This is clearer, allows better code reuse, and is more robust.


I agree (about the robustness), and it works perfectly.

Walter

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-2013 All Rights Reserved.