Re: [xsl] Extracting hypertext attribut value of an xsl document

Subject: Re: [xsl] Extracting hypertext attribut value of an xsl document
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 30 Jan 2001 18:19:35 GMT

   1°)There's a link on my XSL document and 2°)there's the variable "my_var" 
   witch is defined *out* from the <a> element (this time).

   <a href="javascript:void(0)" Name="linkName">link</a>
   <xsl:variable name="my_var"><xsl:value-of select=...?></xsl:variable>

   My question is : how can I affect the variable "my_var" using the link Name 
   attribute (Name="linkName") instead of using it value ("linkName") ?

   I can directly affect "my_var" with the "linkName" string as follows...

   <xsl:variable name="my_var">linkName</xsl:variable>

   ... but I prefer to affect it using the Name link attribute.

If your aim is to avoid specifying LinkName twice, then you just need to
specify the variable first:

   <xsl:variable name="my_var">LinkName</xsl:variable>
   <a href="javascript:void(0)" Name="{$my_var}">link</a>

If you really want to have it on the order you said, you need to read
the stylesheet as an input document to itself, like so

   <a href="javascript:void(0)" Name="linkName">link</a>
   <xsl:variable name="my_var"  select="document('')//a/@Name"/>

if there's more than one <a> in your stylesheet that has a Name
attribute then you'd have to give a more specific xpath to it.


 XSL-List info and archive:

Current Thread