Expandable html?

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Expandable html?

 
0
  #1
Nov 27th, 2006
I have been requested to create a file which will act like an XML page (expandable tree-like structure). I have been given the following requirements:

1. End user requires that the page be an xml file. No problem there, I know enough (barely) to do that.

2. Request that, if possible, I should hide the tag information. That is, instead of showing this:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <heading>Hello there!</heading>
, I should simply have it read, in that kind of situation, "Hello there!".

As far as I know, it is impossible to do this (remove the tags from the display) in XML. However, I am under the (possibly mistaken) impression that an XSL stylesheet can transform the basic xml page into something resembling ordinary html. So, basically, is there any guaranteed way, in HTML alone, to imitate the expandability of an XML page? I've searched google about it, but everything I came up with appeared to rely on either php code or javascript, and I cannot count on either of those to be present in the end user's system. So, my questions are:

A) Is it possible, using only html, to imitate this functionality?
and
B) If so, can anyone suggest a good place to discover information concerning how to do this?

Thank you for your consideration,
-EnderX
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Expandable html?

 
0
  #2
Nov 27th, 2006
You could do it, but you'd need some Javascipt to create the expand/collapse buttons, and (probably) some XSL to convert the XML into HTML.

Non-JS alternatives would involve some messy backend stuff with query strings... (and heck, if you're using client-side XSL transformations, getting hold of the query string is like getting hold of the holy grail [but it is possible])

PHP doesn't have to be present in the end user's system, it's server-side. But like I said, it will be messy witout Javascript...
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,311
Reputation: vishesh is on a distinguished road 
Solved Threads: 36
vishesh's Avatar
vishesh vishesh is offline Offline
Nearly a Posting Virtuoso

Re: Expandable html?

 
0
  #3
Nov 28th, 2006
Yes you would really have learn XSL & JavaScript. javascript could give you best results.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Re: Expandable html?

 
0
  #4
Nov 28th, 2006
I have always been told not to rely on using Javascript, as it is possible that the files I create might be viewed by someone with Javascript functionality turned off in their system. Is there absolutely no way to do this without resorting to Javascript?
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Expandable html?

 
0
  #5
Nov 28th, 2006
Yes, there is, you can do it all with server side scripting, or alternatively, make lots of files that represent every potential state that your tree can be in.

You could even do it with
Server Parsed XML, but you'd still need a way of maintaining state (possibly a session cookie, or a huge dynamic key that is generated by a server side script and affects the XML file returned by a page request at each click).

If you only want one area (node) of the tree to be expanded at a time, then I suppose it's easier, but it still requires a bit of href logic on your part when writing or generating the pages.

Why not show the tree expanded, and if Javascript is running on the computer, use it to collapse all of the unwanted nodes? That way, users who don't use JavaScript will have alot to read, and user's with JavaScript will only have a slight advantage.

I don't like using Javascript for anything that represents a "core" functionality.

EDIT: I should add, relying on client side XSL transformations is worse than relying on JavaScript! IF you are using XSL, look at the Xalan application (www.apache.org) if you want to generate pages one-time on your computer; or the PHP XSLT module if your pages might change frequently.
Last edited by MattEvans; Nov 28th, 2006 at 12:51 pm.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum


Views: 2194 | Replies: 4
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC