wo****@hotmail.com (wooks) writes:
I would appreciate some guidance not just to the solution but why my
own solutions don't seem to work. Copy.xsl in the code below is an
imported identity template.
Non solution 1
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import href="copy.xsl"/>
<xsl:template match="//text()[.=following::text()]"/>
</xsl:stylesheet>
Non Solution 2 (because I suspected there may be some issues about
what is the current node)
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import href="copy.xsl"/>
<xsl:template match="text()">
<xsl:apply-templates select="text()[not(.=following::text())]"/>
</xsl:template>
</xsl:stylesheet
Perhaps you could show an example of what you hope to achieve.
Your first transformation seems to do exactly what you ask:
it removes a duplicated text node.
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//text()[.=following::text()]"/>
</xsl:stylesheet>
with
<foo>
<a>aaa</a>
<a>bbb</a>
<a>aaa</a>
</foo>
gives
<foo><a/><a>bbb</a>
<a>aaa</a>
</foo>
Ie. the first "aaa" text node is removed. Or were you
after something else?
Ben
--
Ben Edgington
Mail to the address above is discarded.
Mail to ben at that address might be read.
http://www.edginet.org/