Re: [xsl] self axis vs .

Subject: Re: [xsl] self axis vs .
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Sat, 7 Jun 2008 00:06:40 +0200 (CEST)
Mukul Gandhi wrote:


> <xsl:for-each select="*">
>   <xsl:if test="self::elem">
>     <!-- do something -->
>   </xsl:if>
> </xsl:for-each>

> Here I am traversing element nodes of any name. If a node in
> the list is 'elem', I want to do something ...

  As in:

    <xsl:apply-template select="*"/>

    <xsl:template match="elem">
       <!-- do something -->


  More seriously, I think I haven't seen the (almost) single use I ever
made of self::, within XPath expression:


  But for excluding a set of names from an XPath in XSLT, I rather use
the following:

    <xsl:variable name="to-exclude" as="element()+">

    *[not(node-name(.) = $to-exclude/node-name(.))]



Envoyez avec Yahoo! Mail. Une boite mail plus intelligente

Current Thread