You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Chris Haskins <ch...@apakgroup.com> on 2004/01/27 12:04:28 UTC

Override the default XSLT templates

Hi,

I have a program that generates a lot of XML, although I am just
interested in some of this data and have created templates to handle
this. The problem is that all the other data(text) gets dumped at the
bottom of the file, so the default template must be doing this. I have
tried to override this default template with the following;

<xsl:template match="text()|@*" mode="?"> </xsl:template>

The default template does:

<xsl:template match="text()|@*" mode="?">
	<xsl:value-of select="."/>
</xsl:template>


My new template works when I try it in 'XML Spy' as in these unwanted
values don't appear, but not when I do a transform using Xalan they are
still output. Am I right in thinking that the default template is not
being overridden? Is there something different that I have to do when
using Xalan to achieve the same results?

Thanks

Chris


**********************************************************************
The information contained in this message or any of its attachments may
be privileged and confidential and intended for the exclusive use of the
addressee.  The views expressed may not be APAK policy but the personal
views of the originator.  If you have received this message in error, please
advise the sender immediately by reply e-mail and delete this message and
any attachments without retaining a copy.  This footnote also confirms that
this email message has been swept for the presence of known computer
viruses before being sent.
**********************************************************************


Re: Override the default XSLT templates

Posted by Gordon Chiu <gr...@apache.org>.
Hi Chris,

You cannot use wildcards for mode. You will need to use
<xsl:template match="text()|@*"> </xsl:template>
and one
<xsl:template match="text()|@*" mode="myMode"> </xsl:template>
for each mode you employ in your stylesheet.

Cheers,
Gordon

On Tue, 27 Jan 2004, Chris Haskins wrote:

> I have tried to override this default template with the following;
> <xsl:template match="text()|@*" mode="?"> </xsl:template>