You can override this default template behavior by adding the following
<xsl:template match="text()|@*"/>
This would allow you not to print the element text and attribute text.
Klaus Malorny
<[EMAIL PROTECTED]
ipp.de> To
Michael Bauer <[EMAIL PROTECTED]>
08/22/2007 02:42 cc
AM [email protected]
Subject
Re: Text output between tags
Michael Bauer wrote:
> I know I am a newb, but please bear with me:
>
> I have a simple XSL doc:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="text()|@*"/>
> <xsl:template match="/HTML/BODY">
> Start
> <xsl:apply-templates />
> Stop
> </xsl:template>
> <xsl:template match="[EMAIL PROTECTED]'ffffee']">
> Starting TD Match
> <xsl:copy-of select="."/>
> Ending TD Match
> </xsl:template>
> </xsl:stylesheet>
>
>
> It basically looks for all column nodes with the bgcolor attribute set
> to ffffee. What's wierd is that, upon running it on the page
> at http://biz.yahoo.com/p/, it outputs not only what I tell it too (the
> literals plus the copy of the TD tags), but also the text between ALL
> tags. What am I doing wrong?
>
> The foo.out is one such failed attempt to make this work.
>
> BTW, I am using the nekoHTML recommended earlier, and it seems to parse
> the HTML just fine.
>
>
>
> ------------------------------------------------------------------------
>
Hi Michael,
be aware of the default templates. If the style sheet processor does not
find a
matching template for a node, it applies default templates. The default
template
for an element is to apply the templates to all child nodes, and this
includes
text nodes. And guess what -- the default template for text nodes emits the
content to the output.
Hope that helps.
Klaus