View Single Post
  #2 (permalink)  
Old September 19th, 2005, 05:06 AM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This is what template rules are for.

In your template rule for match="sect"

<xsl:template match="Sect">
        <xsl:apply-templates select="H2"/>

       <xsl:for-each select="//P | //L">

The "//" is clearly nonsense. This processes all the P and L elements (anywhere in the document) while you are processing each sect. You only want to process the children.

Just do apply-templates select="P|L"

and then write one template rule for match="P" and another for match="L".

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote