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 March 15th, 2007, 12:48 AM
Registered User
 
Join Date: Mar 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default hiding and showing the table in html through xslt

i am trying to launch the html screen in that i have got hte code snippet that is inserted in the table. i want to expand or collapse the table using some link ,i am usng java script for that on in xslt but it is not working out cna any one solve my problem?
i have inserted the table betwen <div> tags and used one anchor before the table...
-------------------
code is here ..


<a href="javascript:showhide('<generated id>');">[click here to show /
hide]</a>
<div id="<generated id>" style="display:none">


<table width="100%" align="center" name ="info" border="2" bgcolor="white">

        <tr>
            <th bgcolor="winered">rsource</th>
            <th bgcolor="winered">info</th>
         </tr>
<xsl:for-each select="//concret//epsilon//ep1//infos//info[@rmtype='SQL Server']">
        <tr>
            <td bgcolor="#F5F5DC"><xsl:value-of select="@resource"/></td>
            <td bgcolor="#F5F5DC"><xsl:value-of select="."/></td>
        </tr>
</xsl:for-each>

</table>
</div>

<script type="text/Javascript"> function toggleblocks (postid) {
                var whichpost = document.getElementById(postid);
                if (whichpost.className=="expandblock") {
                whichpost.className="collapseblock";
                }
                else {
                whichpost.className="expandblock";
                }
                }
        </script>
 
Old March 15th, 2007, 05:38 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

This is releated to : http://p2p.wrox.com/topic.asp?TOPIC_ID=57357 but the links went bad.

Code:
<script type="text/javascript">
<![CDATA[
    function toggleSibling()
    {
        if (window.event.srcElement.nextSibling.style.display=="none")
            window.event.srcElement.nextSibling.style.display = "block";
        else
            window.event.srcElement.nextSibling.style.display = "none";
    }
]]>
</script>
to use:

onclick="toggleSibling();


 
Old March 15th, 2007, 06:16 AM
Registered User
 
Join Date: Mar 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you very much
 
Old March 15th, 2007, 07:35 AM
Registered User
 
Join Date: Mar 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i have modifed the code but it is not working..
if i want to use genereate-id! then how should i change the code??
can u please clarify my doubt!!!acutually i am taking data from xml and inserting in the html using xslt, but here in html i want to show or hide the table that exists in the html.




<script type="text/javascript">
[CDATA[
    function toggleSibling()
    {
        if (window.event.srcElement.nextSibling.style.display =="none")
            window.event.srcElement.nextSibling.style.display = "block";
        else
            window.event.srcElement.nextSibling.style.display = "none";
    }
]]>
</script>

<div id="cont" style="display:none" onclick="toggleSibling();">


<table width="100%" align="center" name ="info" border="2" bgcolor="white">

        <tr>
            <th bgcolor="winered">rsource</th>
            <th bgcolor="winered">info</th>
         </tr>
<xsl:for-each select="//cont//epsilon//ep1//infos//info[@rmtype='SQL Server']">
        <tr>
            <td bgcolor="#F5F5DC"><xsl:value-of select="@resource
            <td bgcolor="#F5F5DC"><xsl:value-of select="."/></td>
        </tr>
</xsl:for-each>

</table>

</div>
 
Old March 15th, 2007, 09:59 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Your "onclick="toggleSibling();">" is not in the right location. The code toggles a child of a parent. You have not assigned the code to a parent.

The <table> must be a child of another element.

 
Old March 15th, 2007, 10:28 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Your output in HTMl would look like this:

Code:
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<script>
function toggleSibling()
    {
        if (window.event.srcElement.nextSibling.style.display=="none")
            window.event.srcElement.nextSibling.style.display = "block";
        else
            window.event.srcElement.nextSibling.style.display = "none";
    }
</script>
<body>

<p><a style="cursor:pointer;cursor:hand; font: bold;color: #FF0000" onclick="toggleSibling();">Click ME

</a><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
  <tr>
    <td width="50%">test </td>
    <td width="50%">test</td>
  </tr>
  <tr>
    <td width="50%">test</td>
    <td width="50%">terst</td>
  </tr>
</table></p>

</body>

</html>
 
Old March 16th, 2007, 01:12 AM
Registered User
 
Join Date: Mar 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank u very very very much its working






Similar Threads
Thread Thread Starter Forum Replies Last Post
ODBC linked table showing old data (not refreshing d-fxt Access 3 November 14th, 2007 05:56 PM
Showing HTML tags from database mmfarhan JSP Basics 1 July 1st, 2006 07:48 PM
constructing a HTML table from xml data using xslt rameshnarayan XSLT 0 September 19th, 2005 06:53 AM
Table not showing in IIS PCnGA_30008 ASP.NET 1.0 and 1.1 Basics 5 May 18th, 2004 06:42 PM





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