xsl-list
[Top] [All Lists]

Re: [xsl] Displaying one section of XML file at a time

2006-03-09 13:12:07
Gowri,

At 01:47 PM 3/9/2006, you wrote:
I apologize if this has been answered already.

No need to apologize for that, as we see very few truly new questions.

On the other hand, it happens that others have been asking similar things lately, so paying attention to ongoing threads is a good idea.

My transformation environment --- sending XML with a
stylesheet PI to the browser

My XML file has three sections of data, which I
transform into three tables using XSL style sheet:

Table 1
Table 2
Table 3

I want to display Table 1 by default and let the user
choose to view that data in next two tables by
clicking Table 2 or Table 3.
Is this possible to do by adding JavaScript in my XSL
style sheet?
If yes, would someone be kind enough to send me an
example, or point me to one?

This seems to be a confusing issue, as just yesterday Jon Gorman had to try using an analogy to explain it. When we start using analogies, you know people are having a hard time.

But check the archive listing at
http://www.biglist.com/cgi-bin/wilma/wilma_hiliter/xsl-list/200603/msg00265.html

In any case, what is possible is to generate, using an XSLT stylesheet, an HTML page that will have this behavior. The easiest way to figure out how to do it is to start by mocking up a functioning HTML/Javascript page with the behavior, and then to determine how to write the XSLT to generate it.

We can help with the second part, but the first part is an HTML design question, and therefore not on topic for this list. I'd recommend looking in an HTML or Javascript forum to find your example, and then coming back if you can't figure out how to compose XSLT to create it. In principle, such a transform would be no harder than any other transform to write, as the script you need won't be executed by the transformation; to XSLT it's just data.

To provide an analogy of my own, it's as if you're saying "I want to send a toaster to my brother in Australia so he can make toast. How do I do that?" and the answer is "you put it in a box and take it to the post office (or FedEx or UPS or the carrier of your choice), just the way you would ship him anything else". The fact that in this instance the box happens to contain a toaster (as your page happens to contain Javascript) is really not of interest to the post office, which isn't going to be making toast with it. Just so, the XSLT transformation isn't going to be executing any Javascript that happens to be present in a page that it generates.

Cheers,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--