Subject: Re: [xsl] 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) |
> > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] how to test for the eleme, Michael Kay | Thread | Re: [xsl] how to test for the eleme, David Carlisle |
RE: [xsl] XMLNS attribute in the XM, Passin, Tom | Date | RE: [xsl] generate-d( ) not working, Wendell Piez |
Month |