does anyone knows how to set the value of the JAvaScript variable(whose
code is defined in the HEAD tag),according to the certain value of the
element in the DOM tree, during XSLT transformation ?

The structure of my XML file:

<UpdatePhases>

<PHLIST>
   <PHDATA>
        ...
     <STATUS>for approval</STATUS>
   </PHDATA>
</PHLIST>

</UpdatePhases>

It can be more PHDATA elements inside the PHLIST.

IN XSL file:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output method="html"/>
  <xsl:template match="UpdatePhases">
      <HTML>
      <HEAD>
        <script language="javascript">
              var theval;
              function modifyMilestone(){
               if (theval)
               {
       
str="http://yfsd/servlet/ad?xml=lestone.xml&#038;pid=<xsl:value-of
select="PHLIST/PHDATA/STATUS"/>&#038;mid="+theval;
         location.href=str;
       }
      }
      </script>
   </HEAD>
      <BODY BGCOLOR="#FFFAE6">
...
<form...>
<xsl:apply-templates select="PHLIST/PHDATA"/>
<INPUT type="button" value="Modify" onClick="modifyMilestone()"/>
</form>
...
</body>
</xsl:template>
<xsl:template match="PHLIST/PHDATA">
...
<xsl:if test="STATUS=='for approval' or 'in progress'">
<INPUT type="button" value="Modify" onClick="modifyMilestone()"/>

here set the variable 'theval' if the STATUS element has the value of
for approval or in progress.

</xsl:if>
...
</xsl:template>
</xsl:stylesheet>

Reply via email to