Subject: Re: Accessing current node attributes
From: George Phillips <phillips@xxxxxxxxxxxx>
Date: Tue, 15 Sep 1998 15:04:57 -0700
|
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
|