[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Accessing current node attributes
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|