Forgive me for replying to my own post, but I developed a 1.0 solution to
the problem. I also joined the two steps of my solution into one
stylesheet.
(By the way, ignore the key in my earlier XSL 2.0 solution. I was
tinkering with a key-based solution and forgot to remove the line when I
wrote the 2.0 solution.)
Given this XML source:
<doc>
<paragraph num="1">Yadda Yadda Yadda <italic>Italic Yadda</italic>
Yadda: <blockquote>Blah Blah Blah Blah</blockquote> Yackity Yack
Yack</paragraph>
</doc>
And this XSL stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="mixed"><xsl:apply-templates select="/"
mode="unmix"/></xsl:variable>
<xsl:template match="/">
<html>
<head>
<title>Paragraph Chunking Test</title>
</head>
<body>
<xsl:for-each
select="$mixed/p[not(preceding-sibling::*[1]/name()='p')]">
<xsl:variable name="group" select="@group"/>
<p num="{(_at_)num}">
<xsl:for-each select="../p[(_at_)group=$group]">
<xsl:apply-templates/>
</xsl:for-each>
</p>
<xsl:apply-templates select="following-sibling::blockquote"/>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template match="paragraph/text()" mode="unmix">
<p num="{../@num}"
group="{count(preceding-sibling::blockquote)}"><xsl:value-of
select="."/></p>
</xsl:template>
<xsl:template match="blockquote" mode="unmix">
<blockquote><xsl:apply-templates/></blockquote>
</xsl:template>
<xsl:template match="italic" mode="unmix">
<p num="{../@num}"
group="{count(preceding-sibling::blockquote)}"><span
style="font-style:italic"><xsl:apply-templates/></span></p>
</xsl:template>
<xsl:template match="p"/>
<xsl:template match="blockquote">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="span">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
I get the following result:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Paragraph Chunking Test</title>
</head>
<body>
<p num="1">Yadda Yadda Yadda <span style="font-style:italic">Italic
Yadda</span> Yadda: </p>
<blockquote>Blah Blah Blah Blah</blockquote>
<p num="1"> Yackity Yack Yack</p>
</body>
</html>
Jay Bryant
Bryant Communication Solutions
(presently consulting at Synergistic Solution Technologies)
--~------------------------------------------------------------------
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>
--~--