Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 30th, 2007, 11:34 PM
Registered User
 
Join Date: Aug 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need suggestion to revert colours in menu

HI,
     Am new to XSL and have been given the task to do enhancement on an existing XSL project. The issue is I have a button called County which when clicked pops out a window showing a list of countries…Now when I select a country say “AMERICA” it gets high lightened from light blue(#E7EBF6) to a dark blue(#A9C4EF'). It works fine.But now when I select the next country in the list say “EUROPE” this also gets high lightened listing its branches. Now the issue is I can’t get the previous country to return to normal i.e to light blue when “EUROPE” is selected, and on every “onClick” all the countries are high lightened, is there a way to revert back the other options to normal and high lightened the currently selected one. Before this function was working fine with “onMouseOver” and “onMouseOut” which I have changed to “onClick”.I have hereby enclosed the xsl code. When the “onMouseOut” function is replaced by “onClick” it doesn’t revert back to the normal colour.The P7_Auto layers function used in the code is to just pop-out the window.



<!-- //************************************************** **********
XSL: /xsl/common/regionLayer.xsl
Version : V1.00
 ************************************************** **********//-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">


<xsl:template name="regionLayer">
<style>

            div#regionLayer {position:absolute; left:8px; top:165px; width:101px; height:97px; z-index:4; visibility: hidden"}

</style>

<div style="position:absolute; left:8px; top:165px; width:101px; height:97px; z-index:4; visibility: hidden"><xsl:attribute name="id">regionLayer</xsl:attribute>

  <table border="0" cellspacing="0" cellpadding="1" width="135" bgcolor="000000">

    <tr>
      <td>
        <table border="0" cellspacing="0" cellpadding="0" width="136">

                <xsl:for-each select="//country_biz_nav/region">
 <xsl:if test="count(./*/countrytext[text() != 'disable']) &gt; 0">

    <tr>
   <td bgcolor="#E7EBF6" nowrap="nowrap" class="leftLayerFont11">
  <xsl:attribute:name="onClick">this.bgColor='#A9C4E F';style.fontWeight='bold';P7_autoLayers(1,'region Layer'<xsl:if test="country!=''">,'countryLayer_<xsl:value-of select="position()" />'</xsl:if>)</xsl:attribute>

 <xsl:attribute:name="onMouseOut">this.bgColor='#E7 EBF6';style.fontWeight='normal'</xsl:attribute>
                                                            <xsl:attribute name="id">region_<xsl:value-of select="position()"/></xsl:attribute>

                                                                     <img src="/scybernet2/image/spacer.gif" width="19" height="18" align="absmiddle"/>

   <a href="javascript:;" class="leftLayerFont11" id="layerLinks">
   <xsl:if test="country!=''">

   <xsl:attribute name="onClick">P7_autoLayers(1,'regionLayer','coun tryLayer_<xsl:value-of select="position()" />')</xsl:attribute>
                                                                    </xsl:if>
                                                                      <xsl:value-of select="regiontext" />
          </a>

      </td>

</tr>
                                                                         <xsl:if test="position() != last ()">

     <tr>

     <td bgcolor="#FFFFFF" height="1"></td>

 </tr>

  </xsl:if>


 </xsl:if>

 </xsl:for-each>

        </table>

      </td>

    </tr>

  </table>

</div>



</xsl:template>


</xsl:stylesheet>



 
Old August 31st, 2007, 01:14 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

This isn't actually a XSLT problem is it - is a javascript problem. I recommend working on the transformed file and getting them working stand alone, then putting the changes back into the XSLT.

You might have to look at storing the last country clicked when you and then resetting it manually.

/- Sam Judson : Wrox Technical Editor -/
 
Old August 31st, 2007, 01:30 AM
Registered User
 
Join Date: Aug 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your suggestion will definetly try.

 
Old August 31st, 2007, 03:56 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If you know what HTML you want to generate, then it should be easy to write the XSLT code to produce it. If you don't know what HTML you want to generate, then you have an HTML problem and not an XSLT problem.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
system colours DarrenMelling Pro VB 6 3 December 7th, 2006 06:22 AM
alternating colours ozPATT Excel VBA 3 October 5th, 2005 10:19 AM
how to highlight in three colours? have code but gilgalbiblewheel Classic ASP Databases 3 October 2nd, 2004 11:04 AM
Button Colours interrupt Javascript How-To 7 August 26th, 2004 04:57 PM
open and revert back tag in wysiwyg editor android66 Javascript 0 August 18th, 2004 02:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.