Using div elements in XSL

Here should go questions about transforming XML with XSLT and FOP.
syxxzonz
Posts: 5
Joined: Sat Jun 04, 2005 1:31 am

Using div elements in XSL

Post by syxxzonz »

I'm new HTML,XSL,XML. Basically, I'm new to anything having to do with web pages. However, I have a problem regarding HTML div elements. I have an XSL stylesheet that correctly reads and XML file and formats it accordingly. It has a main body (i.e. <html> and <body> tags) and some javascripts. I start off my file by having a template match. This is where i have my html and body tags. Within my body, I have a table. I basically have a table tag with no cells. Between the table tags I do an apply-template call to apply it to certain elements. When I finish this main section of my code I start applying various templates (i.e. template match = ""). This is where I start forming my cells. However, what I want to do is create a div element so that I can hide and show the first column. In the end, I'm outputting a table with many rows but only two or three columns depending on the data. What I want to do is hide and show the first column. I can add a div tag to the first column in each different template (where the cells are being created with the data), and furthermore, I can use the "display" property to hide it at page load. However, I can't dynamically hide it or show it with a javascript function at the click of a button. I tried it out with a regular web page and it works the way I want it to. However, with an xsl stylesheet, when I create the table in the various templates the div element does not work. I'd appreciate the help. Is there something different that prevents a div element from working properly in an XSL stylesheet?

Renato
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Renato,

The XSL should not affect how the browser renders the generated content.

You should get the result of the XSLT processing and see how is that different from an working output document then adjust the XSLT to generate the working output.

Best Regards,
George
syxxzonz
Posts: 5
Joined: Sat Jun 04, 2005 1:31 am

hiding a specific column in an XSL (how is it done)

Post by syxxzonz »

right...I understand what you're saying, however, when I call a function that hides the first column, it doesn't work.

<table>
<tr>
<td>
<div id="some_name" style="display:none">
<apply-templates .....>
</div>
</td>
</tr>
</table>

this is a basic outlook of my body. I have a button which will call a function that hides that div block. How is it done because the regular way of doing it (i.e. some_name.style.display="none") doesn't work on clicking the button. Is there a way to dynamically hide the information in a column and then displaying at the click of a button?

Renato
syxxzonz
Posts: 5
Joined: Sat Jun 04, 2005 1:31 am

problem solved

Post by syxxzonz »

I solved my problem Thank you
some1
Posts: 2
Joined: Thu Jul 21, 2005 10:54 pm

Re: problem solved

Post by some1 »

[quote="syxxzonz"]I solved my problem Thank you[/quote]

Hi syxxzonz...just wondering how you solved your problem. I need to show/hide rows in a table using javascript in my xsl. I thought of using div or span tags, but it doesn't seem to work. Any help would be greatly appreciated.
some1
Posts: 2
Joined: Thu Jul 21, 2005 10:54 pm

Re: problem solved

Post by some1 »

[quote="syxxzonz"]I solved my problem Thank you[/quote]

hi..just wondering how you fixed your problem. I need to hide rows in a table using javascript.

thanks
Post Reply