Subject: Re: [xsl] self axis vs . From: "Vyacheslav Sedov" <vyacheslav.sedov@xxxxxxxxx> Date: Sat, 7 Jun 2008 18:59:23 +0400 |
it`s for XSLT 1.0 in XSLT 2.0 i prefer use "* except elem" axis 'self' better work for node type testing for example XPath "//*[following-sibling::node()[1][self::comment()]]" select all nodes that immediately followed by comment but maybe it is not optimal way too On Sat, Jun 7, 2008 at 5:44 PM, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote: > On Sat, Jun 7, 2008 at 3:36 AM, Florent Georges <lists@xxxxxxxxxxxx> wrote: >> <xsl:apply-template select="*"/> >> >> <xsl:template match="elem"> >> <!-- do something --> >> </xsl:template> > > I agree that your suggestion above is more clean. > > Following are some use cases where I find self:: axis to be useful. > > <xsl:template match="*[not(self::elem)]"> > <!-- do something --> > </xsl:template> > > <xsl:template match="*"> > <xsl:if test="not(self::elem)"> > <!-- do something --> > </xsl:if> > </xsl:template> > > Of course there could be alternates ways of writing the logic, like > using the name() or local-name() function. > > We could start of a discussion of for-each vs. apply-templates :) You > suggested xsl:apply-template over the for-each example I posted. There > are times when I *don't want to* define a template. I just want to do > for-each at the place where I am. > > > -- > Regards, > Mukul Gandhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] self axis vs ., Mukul Gandhi | Thread | Re: [xsl] self axis vs ., Robert Koberg |
Re: [xsl] self axis vs ., Mukul Gandhi | Date | Re: [xsl] how do you count based on, Tony Zanella |
Month |