[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Displaying one section of XML file at a time

Subject: Re: Displaying one section of XML file at a time
From: Gowri Ratakonda <gratakonda@xxxxxxxxx>
Date: Tue, 21 Mar 2006 14:59:56 -0800 (PST)
xml cv
When I got this working for one section of my XML file
last week, I got excited about figuring it all in my
first attempt. I think I celebrated too soon...:--(

I just added the second section in my XML file, and
when I loop through both the sections to create the
show/hide feature, I have problems both in IE and
Mozilla:

- In IE, it always displays the first section 
  when I click on either of the two links.

- In Mozilla  it dispalys the last section when I
  click on either of the two links.

I am not able to figure out where I doing wrong. Is it
the way I am assigning the <div id> to each section?

My XMl file looks like this:

<macro>
 <macro_name>NRTCLDFFBQ_F1_SNPM</macro_name>
 <library>GS60</library>
 <CV>
   <Vdd>1.35</Vdd>
   <size>9.875</size>
   <electrical>
     <slew>
        <value>2</value>
        <units>PS</units>
     </slew>
     <PTV>
        <strength>N</strength>
        <voltage>1.35</voltage>
        <temp>25</temp>
     </PTV>
     .
     .
     .
   </electrical>
 </CV>
 <CV>
  .
  .
 </CV>
</macro>
-----------------------------------------------------

Here is my XSL template:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<html>

<head>
<title><xsl:value-of
select="macro/macro_name"/></title>

<script type='text/javascript'
src="expand.js"></script>

<style>
.hide { display: none;}
</style>

</head>

<body>
<h1><xsl:value-of select="macro/macro_name"/></h1>

<xsl:apply-templates select="macro/CV"/>
</body>
</html>
</xsl:template>

<xsl:template match="CV">
<h2>Electrical characteristics Process =

<!-- Get the voltage -->
<xsl:variable name="vdd"
select="electrical/PTV/voltage"/>

<!-- Assign it to $id conditionally -->
<xsl:variable name="id">
 <xsl:choose>
 <xsl:when test="$vdd ='1.35'">
  1.35
 </xsl:when>
 <xsl:otherwise>
  1.2
 </xsl:otherwise>
 </xsl:choose>
</xsl:variable>

<a href='javascript:void(0);' onClick="toggle('$id')">
V<sub>DD</sub> = <xsl:value-of select="$id"/></a>
</h2>

<div class="hide" id="$id">
 <table width="95%">
 <tr> 
    <th><xsl:attribute
name="colspan">4</xsl:attribute>
    <b>Parameter</b></th> 
    <th><b>TYP</b></th>
    <th><b>Unit</b></th>
 </tr>
 .
 .
 .
 </table>
</div>
</xsl:template>
</xsl:stylesheet>

-------------------------------------------------------
Here is my JavaScript function:

// Show/hide document sections

function toggle(currentVdd) {
 if (document.getElementById){
	 thisTable =
document.getElementById(currentVdd).style;
   if(thisTable.display == "block"){
		 thisTable.display = "none"
   }
	 else{
		 thisTable.display = "block"
   }
	 return false
 }else{
  return true
 }

}

Thanks,
Gowri


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.