Subject: Re: [xsl] ancestor-or-self and text nodes From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 11 Aug 2005 17:15:00 -0400 |
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:exsl-common="http://exslt.org/common" extension-element-prefixes="exsl-common">
<xsl:variable name="rtf"> <a> <b> <c>some text</c> </b> <d> <e>more text</e> </d> </a> </xsl:variable>
<xsl:template match="/"> <xsl:apply-templates select="exsl-common:node-set($rtf)/*" /> </xsl:template>
<xsl:template match="node()[not(ancestor-or-self::b)]"> <xsl:copy> <xsl:apply-templates select="node()" /> </xsl:copy> </xsl:template>
</xsl:stylesheet>
This produces the following output :
<?xml version="1.0" encoding="utf-8"?><a>some text<d><e>more text</e></d></a>
Why is it that "some text" appears in the output? Surely "b" is an ancestor of the text node "some text"?
<xsl:template match="*"> <xsl:apply-templates/> </xsl:template>
<xsl:template match="*"> <xsl:copy> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template>
Good luck, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] ancestor-or-self and text nod, Kenneth Stephen | Thread | Re: [xsl] ancestor-or-self and text, Marcin Miłkowski |
[xsl] ancestor-or-self and text nod, Kenneth Stephen | Date | Re: [xsl] ancestor-or-self and text, Marcin Miłkowski |
Month |