On Wed, Sep 12, 2018 at 05:49:24PM -0000, Charles O'Connor
coconnor(_at_)ariessys(_dot_)com scripsit:
<root>
<body><div class="abstract">
<h1><b>Bold</b> Intro!</h1>
<p>This is an intro <i>with <b>various</b> formatting</i> and other
stuff.</p>
<p>This is a second para in the intro</p>
<h1>Methods</h1>
<p>There is no method to our madness</p>
<h1>Results</h1>
<p>The results are soooo good . . . </p>
<p> . . . they require . . . </p>
<p> . . . three paragraphs</p>
<h1>Conclusion</h1>
<p>This is all that is necessary</p>
</div></body>
</root>
[snip]
I'd suggest you set up the identity transform (so everything that isn't
specifically matched gets copied)
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
Then add a template for h1:
<xsl:template match="h1">
<title>
<xsl:apply-templates/>
</title>
</xsl:template>
And then use, for the div template:
<xsl:template match="div">
<abstract>
<xsl:for-each-group select="*" group-starting-with="h1">
<sec>
<xsl:apply-templates select="current-group()"/>
</sec>
</xsl:for-each-group>
</abstract>
</xsl:template>
I've just typed this in directly to the email, I haven't tested it. But
the logic should be fine even if I've got a typo somewhere.
-- Graydon
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--