[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: Godmar Back <gback@xxxxxxxxxxxx>
Date: Wed, 2 Jul 2003 09:23:38 -0700 (PDT)
godmar back
> 
> The logic
> 
> <for-each select="X">
>   <choose>
>      <when name="A">
>      <when name="B">
> 
> is needed so often that XSLT provides a special construct for it: it's
> called xsl:apply-templates. Use it!
> 

That was actually one of the alternatives I looked at.  I discarded it because 
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?)

David pointed out that I could achieve my goal of handling B
specially iff it's a child of A using a template matching A/B.
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.

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.  It's fragile because you have related pieces of
style sheet spread out all over your style sheet, and it also seems
prone to breaking if you ever change your DTD.
(Maybe it's a design limitation of XSLT?)

	- Godmar


 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.