Searching for "XSLT positional grouping" will give you some clues. In XSLT 2.0,
<xsl:for-each-group select="*" group-starting-with="h1">
In 1.0 a common approach is
<xsl:variable name="second-h1" select="generate-id(h1[2])">
<xsl:for-each select="p[generate-id(following-sibling::h1[1]) = $second-h1]">
or in this case its simpler.
<xsl:for-each select="h1[2]/preceding-sibling::p">
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference