Closed Thread Icon

Topic awaiting preservation: How to go about doing this (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=12329" title="Pages that link to Topic awaiting preservation: How to go about doing this (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: How to go about doing this <span class="small">(Page 1 of 1)</span>\

 
Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 07-23-2002 23:30

So, I have this page where I want there to be three major sections. These sections are each generated from separate XML files via XSLT (theoretically), so that I have three files which can be included in the web page with SSI or PHP or somesuch.

The user has the option of changing the order of these three sections. Their order preference is saved in a cookie, and I would like it to retain the order they specify when they return.

I'd rather not have the XSLT run for each request. Sorta slow, that would be.

So, the best solution I've thought of so far is to have the XSLT generate three separate XML files whose document element is a <div>, so that they can be easily included inside the main template. I could then include them with PHP, which could react to the cookies and include them in the right order.

But... somehow, this seems unclean to me. I'd much prefer to have an XSLT document that makes the entire index page, since that would allow the XSLT to really make the full document (making <div> the document element for three separate pages seems like a hack). But, of course, that would keep me from being able to react to the user's cookies.

The other way around would be to use PHP or Perl to generate the document for every request, but as I mentioned earlier, this could get slow (XSLT isn't the fastest method out there).

So, my solution will *work*, but it seems not very elegant. And I'd sort of rather avoid the use of PHP. Does anyone have any suggestions or better ideas for this?

someoneInverse
Bipolar (III) Inmate

From:
Insane since: May 2002

posted posted 07-24-2002 10:17

an interesting one
just throwing a couple of ideas out, if you're looking to do the whole thing via xslt , I'd suggest either:

a) reacting to the cookie on the server side, and writing the xlst index document on the fly which you can then pipe down to the client and let them do the rendering
or
b) don't use any server side stuff at all, pipe the standard xslt document down to the client, with the three sections in their default locations but with a visibility: hidden; style. you can use a body onLoad javascript function to examine the cookie and then move the contents of the sections around, finally setting the visibility to visible

on balance, I think that option "a" would probably be the method that I'd go for, but the solution that you came up with would probably merit serious consideration depending on the requirements of the project

ultimately since xslt is still fairly limited at its current stage of development, I usually find that there's always a "dirty hack" sort of feeling in most of the dynamic solutions developed

...although that might just be me

hth
I:.

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 07-24-2002 14:23

Slime - can't help at all, but am just curious why you want to avoid using PHP?


Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 07-24-2002 16:51

Inverse, thanks for the ideas, but I'd like to avoid sending the XSLT to the browser because only Mozilla and IE5+ can handle that (and IE 5 does it poorly).

DL, no good reason. Heh =) I just don't like the idea of using fifty different technologies for this one thing, and I figure the fewer I use the more portable it will be if I ever switch hosting providers. PHP probably wouldn't be a problem, but it still seems icky to have PHP making the single step of grabbing the cookies and including the files.

I'm really not sure if there's a better solution. There probably isn't. I'm just asking in the hope that someone may have an improvement on it. =)

someoneInverse
Bipolar (III) Inmate

From:
Insane since: May 2002

posted posted 07-24-2002 18:41

in which case, option "a" followed by a transform on the server side to render the document into xhtml and then pipe that down to the client, although as you say it could get a little slow with enough users - although, I guess that you could check to see what flavour of browser the client is running and then let them render the transform or do if for them depending on the result...

- perhaps the method you came up might be the simplest method?


« BackwardsOnwards »

Show Forum Drop Down Menu