[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Warning: The attribute axis starting at an attribute node will never select anything


Subject: Re: [xsl] Warning: The attribute axis starting at an attribute node will never select anything
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 31 Oct 2011 13:09:58 +0000

On 31/10/2011 12:58, Mark wrote:
The following line:
<xsl:attribute name="title" select="concat(if (ancestor::Set/@domain eq
'cr') then ........

The code executes the "if/then/else as I expected but produces the
warning: "The attribute axis starting at an attribute node will never
select anything"

What is the proper way to test the value of "ancestor::Set/@domain" that
avoid this warning?
Thanks,
Mark




If the warning comes from that line, it comes from the bit that you have written as ... so it is hard to give explicit help.

If you go

<xsl:template match="@foo">
....  <xsl:value-of select="@bar"/>

then you will get that warning as a foo attribute can not have a bar attribute. What you usually mean is the bar attribute of the element of which the current node is an attribute so


<xsl:template match="@foo"> .... <xsl:value-of select="../@bar"/>

where the ../ gets you up off the foo attribute and on to the containing element, so that you can select the other attribute.


David





-- google plus: https:/profiles.google.com/d.p.carlisle

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________



Current Thread