Ajax with XML and XSL

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

    Ajax with XML and XSL

    Hi, I want to update part of a XML output (generated by Perl CGI). I'm
    using XSL to transform the XML.

    Can I use this approach?

    I need to resort the contents of a table, that gives me the results
    from a query, when someone clicks on one of the names of that table.

    Thanks,
    Bruno

  • Bart Van der Donck

    #2
    Re: Ajax with XML and XSL

    bcochofel wrote:
    Hi, I want to update part of a XML output (generated by Perl CGI). I'm
    using XSL to transform the XML.
    >
    Can I use this approach?
    >
    I need to resort the contents of a table, that gives me the results
    from a query, when someone clicks on one of the names of that table.
    Several approaches are possible:

    - XSL: not my favourite, browser dependencies, client side
    - TDC: only for Internet Explorer, handy, quick, propietary, the same
    concept as eg VBScript, MS Help Viewer, ActiveX, etc.
    - Perl: XML::Simple/XML::Parser, server side, low client requirements,
    solid
    - Ajax: probably okay

    --
    Bart

    Comment

    • bcochofel

      #3
      Re: Ajax with XML and XSL

      I'm working with Linux, so no TDC...
      I have to work only on the client side, but without XSL (I don't know
      how to use XSL on the client...)
      I guess I'll have to stick with Ajax. My problem his: How can I read
      the elements from the XML? DOM? Don't know much about DOM.

      Can I save the elements (using DOM) to an array in Javascript so them I
      can resort whatever I want?

      Bart Van der Donck wrote:
      bcochofel wrote:
      >
      Hi, I want to update part of a XML output (generated by Perl CGI). I'm
      using XSL to transform the XML.

      Can I use this approach?

      I need to resort the contents of a table, that gives me the results
      from a query, when someone clicks on one of the names of that table.
      >
      Several approaches are possible:
      >
      - XSL: not my favourite, browser dependencies, client side
      - TDC: only for Internet Explorer, handy, quick, propietary, the same
      concept as eg VBScript, MS Help Viewer, ActiveX, etc.
      - Perl: XML::Simple/XML::Parser, server side, low client requirements,
      solid
      - Ajax: probably okay
      >
      --
      Bart

      Comment

      • Dag Sunde

        #4
        Re: Ajax with XML and XSL

        bcochofel wrote:
        <snipped/>
        I'm working with Linux, so no TDC...
        I have to work only on the client side, but without XSL (I don't know
        how to use XSL on the client...)
        I guess I'll have to stick with Ajax. My problem his: How can I read
        the elements from the XML? DOM? Don't know much about DOM.
        >
        Can I save the elements (using DOM) to an array in Javascript so them
        I can resort whatever I want?
        >
        That's what I would have done...

        Loop through the DOM to build your JS array, and build your table
        from that.
        Each time the user clicks on a column heading, resort the array
        and rebuild your table from JS.

        --
        Dag.



        Comment

        • bcochofel

          #5
          Re: Ajax with XML and XSL

          My problem his that I have to use XSL on the server side to generate
          the table.
          Maybe after that I can create the JS array but I'll have something like
          this (in XML):

          <?xml version="1.0" encoding="iso-8859-1"?>
          <?xml-stylesheet type="text/xml" href="RR.xsl"?>
          <!-- $Id: template.xml,v 1.5 2006/12/11 11:13:30 bcochofel Exp $ -->
          <RR
          xmlns:xsi="http ://www.w3.org/2001/XMLSchema"
          xsi:schemaLocat ion="http://cochofel.sytes. net
          ~bcochofel/iweb/files/RR.xsd">
          <Request>
          <url>/~bcochofel/iweb/cgi-bin/getmysites.cgi</url>
          <session>
          <user>g...@coch ofel.net</user>
          </session>
          <query>
          <!-- o campo parametro pode ter varias ocurrencias -->
          <param name="sort" value="asc" />
          <param name="field" value="" />
          </query>
          </Request>
          <Response>
          <sites>
          <site url="http://www.google.com" >
          <tag name="pesquisa" weight="30" />
          <tag name="procura" weight="30" />
          </site>
          <site url="http://www.google.com/webhp?complete= 1">
          <tag name="ajax" weight="25" />
          <tag name="pesquisa" weight="30" />
          <tag name="procura" weight="30" />
          </site>
          <site url="https://webmail.fe.up.p t">
          <tag name="email" weight="20" />
          <tag name="feup" weight="20" />
          </site>
          </sites>
          </Response>
          </RR>

          So <sitecan have several <tagelements.
          How can I create an array with JS like this? I want to sort by
          site[@url] attr, tag[@name], or tag[@weight]...

          Dag Sunde wrote:
          bcochofel wrote:
          <snipped/>
          I'm working with Linux, so no TDC...
          I have to work only on the client side, but without XSL (I don't know
          how to use XSL on the client...)
          I guess I'll have to stick with Ajax. My problem his: How can I read
          the elements from the XML? DOM? Don't know much about DOM.

          Can I save the elements (using DOM) to an array in Javascript so them
          I can resort whatever I want?
          >
          That's what I would have done...
          >
          Loop through the DOM to build your JS array, and build your table
          from that.
          Each time the user clicks on a column heading, resort the array
          and rebuild your table from JS.
          >
          --
          Dag.

          Comment

          Working...