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

Re: how to test for the element type of the current no

Subject: Re: how to test for the element type of the current node
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 2 Jul 2003 17:53:06 +0100
dom element type
  I didn't know how to select "non-B children of A", now I know that you can use 
  match="A/*[not(self::B)]"  (true?)

you can do that but it looks horrible and the normal style is, as I said
to have two templates
 match="A/B" priority="2"
 match="A/*" priority="1"

you don't need to guard the * as the A/B template has higher priority
(That is why templates have a priority, to save you getting the logic
right to make sure all matches are mutually exclusive)

  In fact, using such a template would be required because xsl:template is 
  not scoped and can only occur at the top level, so I can't put one
  inside the xsl:template for A.

I don't know what you would want a template inside a template to mean
(there were several suggestions in early drafts of xslt) so I can't
really comment on this.

  This, btw, appears bad style: you're adding top-level elements
  to your XSL that really only have a meaning inside a subtree
  of your input DOM. 

That is normal XSLT style.

If you have a template  match="td" then that is also probably only
applicable inside a tr element, having match="tr/td" just makes that
explict and is arguably better style.

> (Maybe it's a design limitation of XSLT?)

Its not a limitation, it's the basic style of XSLT programming (whether
you _like_ that style is personal choice of course)
the template model is that it is the source that drives the processing
not the stylesheet, so if you have a template match="a" that applies all
over the place wherever there is an <a> in the source.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 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.