xsl-list
[Top] [All Lists]

Re: [xsl] XSLT Output contains the unwanted content of all elements as text

2007-03-08 09:05:15
Florent Georges wrote:
<xsl:template match="*"/>

With the OP example, that will result in no output at all,
as the root element will match this template rule and no
other processing will be done.  But off course that depends
on the whole, real stylesheet of the OP.  Maybe the
following can help him, too:

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

Florent, that is not the case. Though I often use your throw-away template because it is so easy and has clear semantics, the normal precedence rules apply, even if you use the element() constructor for a match (which is, I believe, a bit odd though). The OP had:

<xsl:template match="element(zoo:country)">

which is the long form of saying:

    <xsl:template match="zoo:country" >...


and a specific element reference has a higher precedence than a generic one. So, adding something like:

    <xsl:template match="*" />


will work, and will still call the appropriate other templates in due cause. In cases where you have large input document with many elements and only a few needs to be processed, I believe that it is a bit faster than the text() node approach (some estimate I like to refer to as running time by granularity approximation, but I may be wrong).

-- Abel


--~------------------------------------------------------------------
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>
--~--