Re: Variables and inherited attributes

Subject: Re: Variables and inherited attributes
From: T_MULLEN 58211 6th Singer St <Tom.Mullen@xxxxxxxxxxx>
Date: Fri, 23 Jun 2000 11:01:44 +0000 (GMT)
I'm new at this so apologies if this is naive but from my recent reading of
the XSLT spec I remembered this:

(excerpt from last paras of 7.6.1)

"The following precedes each procedure element with a paragraph containing
the security level of the procedure. It assumes that the security level
that applies to a procedure is determined by a security attribute on the
procedure element or on an ancestor element of the procedure. It also
assumes that if more than one such element has a security attribute then
the security level is determined by the element that is closest to the
procedure.

<xsl:template match="procedure">
  <fo:block>
    <xsl:value-of select="ancestor-or-self::*[@security][1]/@security"/>
  </fo:block>
  <xsl:apply-templates/>
</xsl:template>

"

>> the currently active value for xml:lang is
>> 
>> <xsl:value-of select="ancestor-or-self::*/@xml:lang[1]"/>
>> 
>Not quite; that select expression returns the set of xml:lang values on
all
>ancestor nodes (the [1] does nothing, as an element can't have two
xml:lang
>attributes), and the xsl:value-of then selects the string value of the
first
>one in document order, which is the outermost.
>
>Correct is:
>
><xsl:value-of select="(ancestor-or-self::*/@xml:lang)[last()]"/>
>
>or (perhaps marginally faster)
>
><xsl:value-of select="ancestor-or-self::*[@xml:lang][1]/@xml:lang"/>
>
>Mike Kay
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-----------------------------------------------------------------
        Visit our Internet site at http://www.reuters.com

Any views expressed in this message are those of  the  individual
sender,  except  where  the sender specifically states them to be
the views of Reuters Ltd.


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


Current Thread