XML Transformation Effectiveness.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bucco

    XML Transformation Effectiveness.

    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

  • VK

    #2
    Re: XML Transformation Effectiveness.

    > 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.c om/xsl/xsl_for_each.as p>

    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.

    Comment

    • Bucco

      #3
      Re: XML Transformation Effectiveness.

      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

      Comment

      • VK

        #4
        Re: XML Transformation Effectiveness.

        > What about using Javascript to update the info on the XML?[color=blue]
        > 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?[/color]

        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?

        Comment

        • Bucco

          #5
          Re: XML Transformation Effectiveness.

          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

          Comment

          • VK

            #6
            Re: XML Transformation Effectiveness.



            Bucco wrote:[color=blue]
            > 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[/color]


            If I'm getting you right, you're looking for something like userData
            behavior in IE:
            <http://msdn.microsoft. com/library/default.asp?url =/workshop/author/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?

            Comment

            • Martin Honnen

              #7
              Re: XML Transformation Effectiveness.



              VK wrote:
              [color=blue][color=green]
              >>transformin g XML into XHTML?[/color]
              >
              > 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.[/color]

              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.


              --

              Martin Honnen

              Comment

              • Christopher J. Hahn

                #8
                Re: XML Transformation Effectiveness.

                Bucco wrote:[color=blue]
                > 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[/color]

                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.create Element to create a node, for instance.
                document.append Child 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 FileSystemObjec t 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.

                Comment

                • Bucco

                  #9
                  Re: XML Transformation Effectiveness.

                  Yes. This is exactly what I was looking for.

                  Thanks:)
                  SA

                  Comment

                  • Christopher J. Hahn

                    #10
                    Re: XML Transformation Effectiveness.

                    Christopher J. Hahn wrote:[color=blue]
                    > Bucco wrote:[/color]
                    [snip][color=blue][color=green]
                    > > 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.
                    > >[/color][/color]

                    [snip][color=blue]
                    > If this is the case, then the JS interface to the DOM should work
                    > perfectly for your needs, with some minor divergences.
                    >
                    > Use document.create Element to create a node, for instance.
                    > document.append Child to append the node as the last child of
                    > another.
                    > et cetera.[/color]

                    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.appe ndChild( thisNode );

                    Sorry if that messed you up at all.

                    Comment

                    Working...