xsl-list
[Top] [All Lists]

Re: [xsl] Getting the first p inside a div

2008-08-19 11:25:56
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

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>