[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
> > 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|