This looks like what I need. Thanks for all of the responses.
David
On Wednesday 25 June 2008 12:28:48 am Mukul Gandhi wrote:
As you have discovered, your stylesheet is not a well-formed XML so it
cannot work through the XML parser.
This looks to me a positional grouping problem, which can be solved
efficiently in XSLT 1.0 with the "sibling recursion" technique.
Below is the stylesheet for the same.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/root">
<root>
<xsl:for-each select="e[(_at_)t = 'a']">
<e>
<xsl:apply-templates select="following-sibling::*[1]" />
</e>
</xsl:for-each>
</root>
</xsl:template>
<xsl:template match="*">
<xsl:if test="not(self::e[(_at_)t = 'b'])">
<xsl:copy-of select="." />
<xsl:apply-templates select="following-sibling::*[1]" />
</xsl:if>
</xsl:template>
</xsl:stylesheet>
On 6/25/08, David Frey <dpfrey(_at_)shaw(_dot_)ca> wrote:
I have a simple XSLT problem for the gurus.
This is my input document:
<root>
<e t="a"/>
<f/>
<f/>
<e t="b"/>
</root>
This is the output document I want to produce:
<root>
<e>
<f/>
<f/>
</e>
</root>
--~------------------------------------------------------------------
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>
--~--