[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] copy-of question


Subject: Re: [xsl] copy-of question
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 19 Apr 2001 19:19:40 +0100

Hi Franz,

> Jeni, I don't have a deep copy here (I want the complete original
> html table inside the xml), but only the table text cells as output

Sorry - I don't understand what you mean by the above. Let me try
again. You said:

> how can I extract only one element in original form?
> copy-of seems to work here, but I have all the other unwanted tags also as
> plain text.
> Is this related to the default rules?
>
>  <xsl:template match="TABLE">
>    <xsl:copy-of select="."/>
>  </xsl:template>

If this is the only template you have in your stylesheet, it will give
you a (deep) copy of any TABLE elements in your document.  The rest of
the nodes in the stylesheet (aside from those under the TABLE
elements) will have the built-in templates applied to them.  The
effect of these built-in templates is that you get the text of the
rest of the document output.

If you don't want that text to be output, then adding the empty
template:

<xsl:template match="text()" />

will stop it being output.  You'll still get the (deep) copy of the
TABLE elements, but this seemed to be what you were after (you said
that was working).

If you have a stylesheet with these two templates in it, and you're
only getting the text of the table cells in your output, then I bet
you've got an xsl:output instruction that looks like:

<xsl:output method="text" />

Take out that xsl:output instruction, or replace it with one that
looks like:

<xsl:output method="xml" />

If you use the 'text' method, the XSLT processor doesn't output any
elements that you create, only text nodes.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords