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

Subject: Re: [xsl] Extracting hypertext attribut value of an xsl document
From: "frank Stein" <freeposte@xxxxxxxxxxx>
Date: Tue, 30 Jan 2001 17:28:43
Hello David,
here goes a corrected and simpler example of my request.

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.

Could You please give me another hand on this one now ?

Thank-You.

Ovide

From: David Carlisle <davidc@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
CC: XML-L@xxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Extracting hypertext attribut value of an xsl document
Date: Mon, 29 Jan 2001 18:28:30 GMT

> Please could you give me a hand on this one ?

You might need to be more specific about what you are trying to do.



> I would like to extract out the attribute value of an hypertext tag in order
> to affect it to on an XSL variable.
>
> Example:
>
> <xsl:template match="RootLevel">
> <a href="javascript:void(0)">
> <xsl:attribute name="Name">
> <xsl:value-of select="my_name"/>
> </xsl:attribute>
>
> <xsl:variable name="my_var">
> <xsl:value-of select="(here goes the hypertext Name attribute
> value)"/>


I'm not sure what you mean here, but the Name attribute in the result
tree wiill have the value returned by  <xsl:value-of select="my_name"/>
so it would appear that you could use that (but I suspect you mean
something else?)

>      </xsl:variable>
>      </a>
>
>    <xsl:apply-templates select="Level[@Name=$my_var]"/>

This will generate an error as the my_var variable is defined inside the
<a> element above, and so is local to that literal result element, but
this line is after th eclosing </a>.

> </xsl:template>
>
> How do you "call" the attribut "Name" containing "my_var" and then how
> should the value "my_var" be extracted ?
>
> Thank-You.
>
> Ovide.


<xsl:template match="RootLevel">
   <a href="javascript:void(0)" Name="{my_name}"/>
   <xsl:apply-templates select="Level[@Name=my_name]"/>

is syntactically correct but it's hard to know if that's what you want
without any idea of the input file or the required output.

This presumes an input dsocument that looks like

<RootLevel>
  <my_name>xxx</xxx>
...
  <Level Name="xxx">
...
  </Level>
</RootLevel>

and an output that looks like

<a href="javascript:void(0)" Name="xxx"/>
...

David



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


_________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


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



Current Thread