XML Transformation Effectiveness.

B

Bucco

How effective is Javascript in transforming XML into XHTML? I'm
wanting to use the XML file to store data that will then be transformed
into the XHTML file for displaying of the data. I want to keep it real
simple and all text so that it is easily transportable.

Thanks in advance.
:)

SA
 
V

VK

transforming XML into XHTML?

What does it have to do with JavaScript?

Simply attach an XSL template to your XML data file, and browser will
do the rest automatically.

You may need a couple of XPath instructions inside of your template to
deploy your page. Actually single "for_each" instruction will cover all
your needs for the first time:
<http://www.w3schools.com/xsl/xsl_for_each.asp>

It works on everything what we can call a *browser* right now: FF 1.0.3
and higher, IE 5.5 and higher, Netscape 8 and higher, Opera 8 and
higher.

JavaScript comes very useful *later* if you decide to enrich your
ready-to-use page with timed updates, popups, menus etc. etc.
 
B

Bucco

What about using Javascript to update the info on the XML? I agree
that I can transform the XML the way you suggested, but I still want a
platform independant way of putting new data intot the XML file. Any
ideas?

Thanks:)

SA
 
V

VK

What about using Javascript to update the info on the XML?
I agree that I can transform the XML the way you suggested, but I still want a
platform independant way of putting new data intot the XML file. Any
ideas?

You mean update data on the server? You can deploy your XML into a nice
HTML form, so user has just press submit after (s)he finished
typing/clicking. Some server-side processing of course needed (ASP, C#
behaviors, PHP etc.)

And as I said XML/XSL is platform independent (look at the list of
supported browsers).

Well, last year I've seen a guy posted here with userAgent string:
"Pan 0.0.3 : The Whole Remains Beautiful" (I am *not* joking!). He
announced several times that his browser was the only real one and all
others were total crap. And disappeared... God thanks...

I guess there will always be a greate amount of such "The Whole Remains
Beautiful"s around the world, specially after the appearance of open
source browser codes and drag-and-drop programming GUI. The total
amount of users of each of such browser rarely exceeds the author
himself and his/her best friends and relatives. So relax and think of:

Firefox 1.0.4 and higher
Internet Explorer 5.5 and higher
Opera 8 and higher.
(presuming you're under Windows so can install each of them).

If it works under each of three, you have rights to think that it works
everywhere (as much as everywhere can be applied to the Web).

If another talent gets his way to the top, you will here it and you
will add it to the list (or replace something in that list with the new
winner, who knows.)

What exactly you want to update? User records, goodies specs, stock
news?
 
B

Bucco

I was actually looking for a server independant app like TiddlyWiki.
TiddlyWiki uses Javascript, css, and html to generate a dynamically and
saveable one file wiki without the need for a server. This allows the
user to take the html document anywhere with them without being
restricted to a server with server side scripts.

The thing I want to do is very similar, accept I want to add an XML
file to store data that is added through the HTML interface. The XML
data can then be pulled back out and displayed through the HTML
interface.

Does this make sense?

Thanks:)

SA
 
V

VK

Bucco said:
I was actually looking for a server independant app like TiddlyWiki.
TiddlyWiki uses Javascript, css, and html to generate a dynamically and
saveable one file wiki without the need for a server. This allows the
user to take the html document anywhere with them without being
restricted to a server with server side scripts.

The thing I want to do is very similar, accept I want to add an XML
file to store data that is added through the HTML interface. The XML
data can then be pulled back out and displayed through the HTML
interface.

Does this make sense?

Thanks:)

SA


If I'm getting you right, you're looking for something like userData
behavior in IE:
<http://msdn.microsoft.com/library/d...or/behaviors/reference/behaviors/userdata.asp>

So you want your browser page would act as a word-processor document:
once obtained, always keep the last "save" state. Am I right?
 
M

Martin Honnen

VK said:
Simply attach an XSL template to your XML data file, and browser will
do the rest automatically.

It works on everything what we can call a *browser* right now: FF 1.0.3
and higher, IE 5.5 and higher, Netscape 8 and higher, Opera 8 and
higher.

That is not true, Opera 8 has no XSLT support at all. And even IE 5.5
with the normal installation has no XSLT 1.0 support at, it only
supports a predecessor of XSLT 1.0 language. IE 5 or 5.5 can only do
XSLT 1.0 if MSXML 3 is installed next to IE in so called replace mode.
 
C

Christopher J. Hahn

Bucco said:
I was actually looking for a server independant app like TiddlyWiki.
TiddlyWiki uses Javascript, css, and html to generate a dynamically and
saveable one file wiki without the need for a server. This allows the
user to take the html document anywhere with them without being
restricted to a server with server side scripts.

The thing I want to do is very similar, accept I want to add an XML
file to store data that is added through the HTML interface. The XML
data can then be pulled back out and displayed through the HTML
interface.

Does this make sense?

Thanks:)

SA

If I understand correctly (and I'm not really familiar with much of
XML/XHTML), XHTML is a subset of XML. Hence, anything XHTML is by
definition also XML.

If this is the case, then the JS interface to the DOM should work
perfectly for your needs, with some minor divergences.

Use document.createElement to create a node, for instance.
document.appendChild to append the node as the last child of
another.
et cetera.

Use an external CSS file, imported using a <link> node, for
presentation.

As far as saving it, you can do one of two things:
1. Turn down security settings in IE for the local zone, then use the
ActiveX FileSystemObject to open a file and write the source of your
manufactured document to it.

2. Output the source in, say, a textarea, from which you can copy and
subsequently paste into a text editor and manually save.

Both ways are a bit kludgy, but what you end up with is a file that you
created from JavaScript, with source that acts as both XHTML and XML.

You can subsequently import it from the local filesystem using an
<object> or <iframe>, or access it directly. I don't think that
XMLHTTPRequest would work on the local filesytem, but it might.

You don't necessarily have to make it XHTML, I don't think, but I don't
see why you wouldn't.

Don't know if that helps any, but I hope it does.
 
C

Christopher J. Hahn

Christopher said:
Bucco wrote: [snip]
The thing I want to do is very similar, accept I want to add an XML
file to store data that is added through the HTML interface. The XML
data can then be pulled back out and displayed through the HTML
interface.
[snip]
If this is the case, then the JS interface to the DOM should work
perfectly for your needs, with some minor divergences.

Use document.createElement to create a node, for instance.
document.appendChild to append the node as the last child of
another.
et cetera.

I made a rather grievous error, here. You would use the appendChild
method of the node to which you wish to append this one... i.e.

targetNode.appendChild( thisNode );

Sorry if that messed you up at all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top