p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > XML > XSLT
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 26th, 2009, 04:21 PM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Jun 2007
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Hide/Show Template

currently I have it set up like this:

Code:
<xsl:template match="enrollment_list"> 
<script language="JavaScript" src="js/motionpack.js"></script>   
    <script type="text/javascript">
    function viewIt(){
        
        document.getElementById('coursesList').style.display = 'block';
        document.getElementById('coursesList').style.visibility = 'visible';
        document.getElementById('coursesList').style.height = '100%';        
    }
    </script>
    <tr>
     <td>
      <table cellspacing="0" cellpadding="2" border="0">
         <tr>
         <td><font class="uportal-channel-strong">
         <xsl:value-of select="title"/>
         </font>
          &nbsp;-&nbsp;<a href="#" onclick="viewIt()">View</a> 
         <br/></td>
         </tr>
         <xsl:apply-templates select="empty"/>         
         <xsl:apply-templates select="enrollment"/>
      </table>
     </td>
    </tr>
</xsl:template>

<xsl:template match="enrollment">
    <script type="text/javascript">
        document.getElementById('coursesList').style.display = 'none';
        document.getElementById('coursesList').style.visibility = 'hidden';
        document.getElementById('coursesList').style.height = '0px';
    </script>
    <tr>
     <td id="coursesList">
      <font class="uportal-channel-text">
      &bullet; <a href="{lctxt/href1/@newLink}" target="_blank"><xsl:value-of select="lctxt/text1"/></a>
      </font>
     <img src="{$imagepath}/transparent.gif" border="0" height="10" width="5"/> 
     <img src="{$imagepath}/transparent.gif" border="0" height="10" width="5"/> 
     <xsl:for-each select="icon">
     <a href="{href/@newLink}" target="_blank">
       <img src="{$webCtServer}{src}" border="0"/>
     </a>
     <img src="{$imagepath}/transparent.gif" border="0" height="10" width="5"/> 
     </xsl:for-each>
     </td>
    </tr>
</xsl:template>
in the enrollment template it basically builds a link for each course the person is in. however the way i currently have it, it only hides the first course in the list, the rest are visible.

Any Thoughts? Basically I would like to toggle hide/show the whole list.

Thanks in advance
Aaron
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old June 27th, 2009, 12:59 PM
samjudson's Avatar
Friend of Wrox
Points: 4,453, Level: 28
Points: 4,453, Level: 28 Points: 4,453, Level: 28 Points: 4,453, Level: 28
Activity: 60%
Activity: 60% Activity: 60% Activity: 60%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 1,359
Thanks: 0
Thanked 31 Times in 31 Posts
Default

This is not really an XSLT question, but a javascript one. You are setting every table cell to have an ID of 'courseList' - then calling getElementById which probably only returns the first one.

Either set the ID on the table so it hides the whole table, or write some JavaScript that loops through all table cells and sets them all to hidden. Where there are more than one item with the same property it is better to use class rather than ID, as ID should ideally be unique throughout a document. For this kind of task something like jquery would probably be of assistance.
__________________
/- Sam Judson : Wrox Technical Editor -/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old June 30th, 2009, 01:10 PM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Jun 2007
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Fixed

The problem was the way I had the XSL laid out. I removed the apply templates portion, and actually nested the template inside the other. Once I did that I could put a div tag around the whole section and hide all the rows.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HIDE/SHOW pallone Javascript How-To 11 April 16th, 2007 11:24 AM
Hide/show rows in a table smi13y XSLT 6 December 28th, 2006 08:48 PM
how to show/hide forms ? ashrafzia C# 3 November 3rd, 2006 11:07 AM
show/hide row(s) eugz Beginning PHP 0 March 19th, 2006 10:10 PM
Show/Hide in a DataGrid bmains ASP.NET 1.1 1 July 29th, 2004 04:16 PM



All times are GMT -4. The time now is 09:30 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc