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

Re: Template rules vs. XQuery (was RE:"*NEVER* use for

Subject: Re: Template rules vs. XQuery (was RE:"*NEVER* use for-each")
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 28 Feb 2001 09:04:56 +0000
Re:  Template rules vs. XQuery (was RE:"*NEVER* use for
Hi Evan,

>         <xsl:when test="count(.|../@*)=count(../@*)">
>           <!-- built-in rule for attribute nodes -->
>           <!-- btw: someone please give me a better way to
>                test whether the current node is an attribute -->
>           <xsl:value-of select="."/>
>         </xsl:when>

In this context, you could use:

  .. and not(self::node())

In fact the root node has already been filtered out, so you don't have
to test whether this node has a parent. The other thing to be aware of
is that this matches namespace nodes too. But if you're only dealing
with a conversion from the matching template version to a named
template version then you're fine because namespace nodes can't be
matched on.

> Is there anything that I'm missing here? Or is there anything that
> could not be converted in such a way?

xsl:apply-imports? - there's no equivalent for named templates.  There
isn't a programmatic way of supporting that because you can't know
which next template is going to be processed without knowing what the
source is going to be.

I think you'd also start running into problems when you add support
for parameters in named templates - you could add them to your
applyTemplates template, but you'd have to take care of name clashes
(with possibly different default values) in it.  But that's a fairly
minor issue - just requires a generate-id()-ed modifier on the name to
make them unique.

Cheers,

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.