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: 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

  <Level Name="xxx"> 

and an output that looks like

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


 XSL-List info and archive:

Current Thread