Re: Accessing current node attributes

Subject: Re: Accessing current node attributes
From: James Clark <jjc@xxxxxxxxxx>
Date: Wed, 16 Sep 1998 11:44:11 +0700
In the next draft I would expect (my personal opinion not an official WG
statement) it to be possible to qualify ".", so you could say

 <xsl:if test='.[attribute(href)="http://www.ibm.com/";]'>

The syntax you suggest

 <xsl:if test='attribute(href)="http://www.ibm.com/";'>

and I can see ways we might be able to make that work as well.

George Phillips wrote:
> 
> Bart Schuller wrote:
> > On Mon, Sep 14, 1998 at 11:32:20AM -0700, George Phillips wrote:
> > >   <xsl:template match="a[attribute(href)]">
> > >     <A HREF="{.[attribute(href)]}">
> > >     <xsl:value-of expr="." />
> > >     </A>
> > >   </xsl:template>
> > >
> > > But "{.[attribute(href)]}" doesn't get me the HREF attribute of the
> > > current A node being processed.  Not that I expect it to as it is
> >
> > Use <A HREF="{attribute(href)}">
> 
> Thanks.  Sorry to ask such a dumb question.  Nevertheless, here's
> another:  can I use <xml:if> to check for particular attribute values?
> For example, one might write:
> 
>         <xsl:template match="a">
>        <xsl:if test='attribute(href)="http://www.ibm.com/";'>
>              <a-link-to-the-ibm-home-page/>
>           </xsl:if>
>         </xsl:template>
> 
> The XSL grammar and xt both agree that the example does not fly.
> Can an "if" test like that be written?  I know you can use;
> 
>         <xsl:template match="a[attribute(href)='http://www.ibm.com/']">
> 
> but that doesn't pan out well if you are testing many different
> attributes in different combinations.
> 
>                         -- George
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread