RE: [xsl] Urgent - Assigning <xsl:variable> with javascript variable

Subject: RE: [xsl] Urgent - Assigning <xsl:variable> with javascript variable
From: "Aparna Konduri" <a_konduri@xxxxxxxxx>
Date: Tue, 06 Aug 2002 08:42:23 -0400
Hello,

I don't have data available in xml file, to assign to ID of <div>. It is to be generated from the javascript variable or random number, I have at run time. Any help will be greatly appreciated.

Thanks,
Ana
---------------------------------------------------------------------

On Mon, 5 Aug 2002 16:49:46   
 Kimberly Hahn wrote:
>I'm not sure what data you are starting out with, so here is some ample XML
>and XSL that builds a div tag and assigns the ID attribute a value based on
>the XML
>
>XSL -
><?xml version="1.0"?>
><xsl:stylesheet version="1.0"
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
><xsl:output method="html"/>
>
><xsl:template match="node1">
>  <xsl:element name="div">
>    <xsl:attribute
>name="style">visibility:visible;display:block</xsl:attribute>
>     <xsl:attribute name="ID"><xsl:value-of select="@name"
>/></xsl:attribute>
>  </xsl:element>
></xsl:template>
></xsl:stylesheet>
>
>XML -
><Data>
><node1 name="Myname"/>
></Data>
>
>
>Output -
><div style="visibility:visible;display:block" ID="Myname">
></div>

------------------------------------------------------------------
Ana wrote:
>
>Hello,

I tried to generate <div> tag dynamically with Javascript. 

id is a javascript variable.

document.write("<div ID="+ id +" style='visibility:visible;
                                display:block'">);
<a href="X"></a>
document.write("</div>");

When I try to access the div tag, the browser complains that such a tag doesn't exist.

Because the above approach is not working, I thought I would do

<xsl:variable name="name">id</xsl:variable>
<div style="visibility:visible;display:block">
<xsl:attribute name="ID">
<xsl:value-of select="@name" />
</xsl:attribute>
<a href="X"></a>
</div>

This also doesn't work. How to store a javascript variable in <xsl:variable>? 

Do you think there is any other way to do this? Please help.


Thanks,
Ana

>
>


__________________________________________________________
Win a First Class Trip to Hawaii to Vacation Elvis Style!
http://r.lycos.com/r/sagel_mail/http://www.elvis.lycos.com/sweepstakes

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


Current Thread