[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Built in templates

Subject: Re: Built in templates
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 5 Apr 2001 11:24:19 +0100
re built
Hi Richard,

> Well I can't remember the exact name but there are builtin rules
> that for example copy all the text() elements accross into the
> output from unrecognised nodes. I want this not to be the case so I
> overrode it like...
>
> <xsl:template match="text()"></xsl:template>
>
> ...however I tend to use a lot of different modes in my mechanism
> and it seems I need to override the builtin template for each and
> every mode - this is not nice. Anybody have any ideas?

<aside>
Hmm... this is interesting. In the section on Built-In Templates in
XSLT 1.0, the only moded built-in template is:

<xsl:template match="*|/" mode="m">
  <xsl:apply-templates mode="m"/>
</xsl:template>

This propagates the application of templates in that mode down the
node tree. I can't see anywhere where it says that there is a built-in
template like:

<xsl:template match="text()" mode="m">
  <xsl:value-of select="."/>
</xsl:template>

But I must have missed something because Saxon, MSXML and Xalan all
seem to operate as if there is.
</aside>

Anyway, a solution might be to only *apply* templates to the nodes
that you *are* interested in, rather than just applying templates to
everything and filtering out the stuff you're *not* interested in.

This shifts those parts of your stylesheet from a 'push' style, driven
by the source document (apply templates to everything and let the
templates determine what they do with which) to a 'pull' style, driven
by the stylesheet (only apply templates to the things you want to get
output for).

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.