943,994 Members | Top Members by Rank

Ad:
Nov 27th, 2006
0

Expandable html?

Expand Post »
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
Similar Threads
Reputation Points: 483
Solved Threads: 1
Posting Shark
EnderX is offline Offline
999 posts
since Aug 2006
Nov 27th, 2006
0

Re: Expandable html?

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...
Moderator
Featured Poster
Reputation Points: 522
Solved Threads: 64
Veteran Poster
MattEvans is offline Offline
1,091 posts
since Jul 2006
Nov 28th, 2006
0

Re: Expandable html?

Yes you would really have learn XSL & JavaScript. javascript could give you best results.
Reputation Points: 85
Solved Threads: 42
Nearly a Posting Virtuoso
vishesh is offline Offline
1,362 posts
since Oct 2006
Nov 28th, 2006
0

Re: Expandable html?

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?
Reputation Points: 483
Solved Threads: 1
Posting Shark
EnderX is offline Offline
999 posts
since Aug 2006
Nov 28th, 2006
0

Re: Expandable html?

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.
Moderator
Featured Poster
Reputation Points: 522
Solved Threads: 64
Veteran Poster
MattEvans is offline Offline
1,091 posts
since Jul 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Simple checkbox validation question
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: null is null or not an object error. No menus work





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC