XML programming



  • By its nature, XML is meant to be extended. Still, this can sometimes go too far. An example is the XIM programming language. I read about this language in an article published in the April 2007 edition of Dr. Dobb's Journal. The approach presented (as far as I understand) is to have a browser's stylesheet processor perform calculations in addition to rendering data. This may be an ingenious use of XML, but I think they're going too far.



  • Using XSLT client-side at all is not something I'd really feel comfortable with, outside of very limited applications (Blogger's XSLT stylesheet it links to from its Atom feeds comes to mind.)



  • @dmitriy said:

    The approach presented (as far as I understand) is to have a browser's stylesheet processor perform calculations in addition to rendering data. This may be an ingenious use of XML, but I think they're going too far.

    Not trying to be snarky, but I don't think you do understand. XSLT isn't anything to do with stylesheets and browser rendering in the CSS sense; it is a Turing-complete declarative  programming language, and there is no reason not to use it to write an interpreter for an imperative language.
     

    The real WTF is that they expect it to execute on the client; they would be better off using one of the many server-side frameworks for XSLT . Firefox in particular has very poor support for XSLT, due to its use  of an XSLT engine that doesn't even fully implement the XSLT 1.0 spec (dating back to 1999). Internet Explorer has had excellent support for XSLT 1.0 since , IIRC, version 5.5.



  • The article talks about using XIM and XSLT as... a scripting language? That's a WTF. It complains about Javascript being on-standard, but as other people have pointed out, XSLT is even more non-standard still.

    It's the same old story... find a useful language and put it into practice without forethought of decent design. Just because you CAN do something doesn't mean you SHOULD.

    It's going to be a good few years yet before the whole 'semantic net' concept is implemented in any usable manner. Serving websites as pure XML content using common namespaces will be fantastic for automated information exchange. Only then is it practical to use the client-side XSLT functionality when a human wants to view the information in that resource. That's what it was intended to do.

    Check out Apache Cocoon to see how XSLT is done "right" - all server-side.



  • @Squiggle said:

    It's
    going to be a good few years yet before the whole 'semantic net'
    concept is implemented in any usable manner.

    Never happen 


    Serving websites as pure
    XML content using common namespaces will be fantastic for automated
    information exchange.

    Complicated non-solution to the wrong problem. 

    Everything in this topic is completely and utterly insane.



  • @asuffield said:

    @Squiggle said:

    It's
    going to be a good few years yet before the whole 'semantic net'
    concept is implemented in any usable manner.

    Never happen

    Please do a google for "microformats" and "GRDDL". 

    @asuffield said:


    Serving websites as pure
    XML content using common namespaces will be fantastic for automated
    information exchange.


    Complicated non-solution to the wrong problem.

    Everything in this topic is completely and utterly insane.

    @fennec said:

    Using XSLT client-side at all is not something I'd really feel comfortable with, outside of very limited applications (Blogger's XSLT stylesheet it links to from its Atom feeds comes to mind.)

    Care to explain those a bit more?


    I admit, I don't have much "real world" experience, but client-side XSLT seems a really clean and elegant solution to me. And in contrast to several others of the W3's the implementation on the 'web is already somewhat progressed.

    Take a look at the source of this. You can actually use it to make websites already.



  • @PSWorx said:

    @asuffield said:

    @Squiggle said:

    It's
    going to be a good few years yet before the whole 'semantic net'
    concept is implemented in any usable manner.

    Never happen

    Please do a google for "microformats" and "GRDDL". 

    Never happen. The web is filled with stupid ideas that will never happen, and google indexes every damned one of them.

    It's possible for people to use this. It's also possible for them to write arias instead of web pages. They won't.


    I admit, I don't have much "real world" experience, but client-side XSLT seems a really clean and elegant solution to me.

    Quoted for hilarity. This is how we get sidebar posts in the first place.

     

    Take a look at the source of this. You can actually use it to make websites already.

    I can think of dozens of assorted things out there that you can actually use to make websites already, and just like this one, they are all used by approximately zero people. There is a reason for this.



  • It reminds me of coldfusion.



  • Here is what's wrong with XSLT.  This is a simple example from the W3C specification:

     <xsl:template match="orderedlist/listitem">
      <fo:list-item indent-start='2pi'>
        <fo:list-item-label>
          <xsl:variable name="level"
                        select="count(ancestor:<WBR>:orderedlist) mod 3"/>
          <xsl:choose>
            <xsl:when test='$level=1'>
              <xsl:number format="i"/>
            </xsl:when>
            <xsl:when test='$level=2'>
              <xsl:number format="a"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:number format="1"/>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:text>. </xsl:text>
        </fo:list-item-label>
        <fo:list-item-body>
          <xsl:apply-templates/>
        </fo:list-item-body>
      </fo:list-item>
    </xsl:template>

    Does that look easy to understand or follow?  Can you imagine writing or maintaining a whole complex program like this?  XSLT should be used in those limited cases where you are doing simple XML transformations.  Anything else is just unmaintainable.



  • Xpath and Xquery are decent enough languages. A bit verbose with some of the selectors, but they leverage heigharchial, object, and relational datasets quite well between them. XSL is a clusterfuck, obviously created by designers expecting it to be generated by drag & drop GUI "programming" tools. It was never meant for more than complex page layout of mostly pre-computed data, and no matter how many iterations of XSLT they make, it'll never outgrow those roots. I just wish other languages would support Xpath & Xquery in a more natural fashion, the way perl supports regexes, but I suppose I'll have to live with tacked-on libraries for now.

    Someone should write a parser that encapsulates all C into xml. Call it XCLT.



  • @asuffield said:

    @PSWorx said:

    Take a look at the source of this. You can actually use it to make websites already.

    I can think of dozens of assorted things out there that you can actually use to make websites already, and just like this one, they are all used by approximately zero people. There is a reason for this.

    Unless you count such organisations as Blizzard Entertainment as zero people (reference: http://www.worldofwarcraft.com/index.xml - note the XML extension on their homepage). In a true stroke of genius, their newfangled armoury thingy is even MORE bloated XML with XSL.  Not even a spec of HTML.  So yeah, some people DO use it.



  • @Kyanar said:

    @asuffield said:
    @PSWorx said:

    Take a look at the source of this. You can actually use it to make websites already.

    I can think of dozens of assorted things out there that you can actually use to make websites already, and just like this one, they are all used by approximately zero people. There is a reason for this.

    Unless you count such organisations as Blizzard Entertainment as zero people (reference: http://www.worldofwarcraft.com/index.xml - note the XML extension on their homepage). In a true stroke of genius, their newfangled armoury thingy is even MORE bloated XML with XSL.  Not even a spec of HTML.  So yeah, some people DO use it.

     

    I'm actually quite intrigued by that example of an XML page with XSLT.  Unless I'm missing something on my end by looking at the source, it's almost a perfect XHTML page, including links for the CSS stylesheets and such.  The only difference is that it has a <page> tag instead of <html><body>, in which case I suppose the XSL stylesheet transforms <page> into <html><body>.  Am I understanding this correctly? (I haven't done any XSLT yet)

    If I'm right, then their use of XSLT is minimal and trivial, and really is just taking an XHTML page and giving it a different extension, yes?  And if so, then what is the point?  And despite showing that somebody is using XSLT, does this really help to show how it can be done well / used effectively, or why it should exist at all?

    By the way, this is neither trolling nor sarcastic -- I seriously wonder what the importance of many of these new "web technologies" is, being that I've built several websites lately (freelance and for a few local businesses) and can't imagine how any of these recent technologies (AJAX, SOAP/XML-RPC, XSLT) could help me or my clients.
     



  • @Kyanar said:

    So yeah, some people DO use it.

    That is explicitly acknowledged by the term "approximately zero" - it's used to refer to cases where something is used by some people, but the number of people is statistically insignificant. You can think of it as meaning "so few people that there is no perceivable difference between a world where it is used by these people, and a world where nobody uses it". (That's a reasonable layman's explanation of the concept of "statistically insignificant")



  • @RevEng said:

    I'm actually quite intrigued by that example of an XML page with XSLT.  Unless I'm missing something on my end by looking at the source, it's almost a perfect XHTML page, including links for the CSS stylesheets and such.  The only difference is that it has a <page> tag instead of <html><body>, in which case I suppose the XSL stylesheet transforms <page> into <html><body>.  Am I understanding this correctly? (I haven't done any XSLT yet)


    Well, um, not ... quite ... I think. While the main page uses it in this manner, I believe Kyanar meant the "Armory" section behind the button on the upper-right - and that one looks as if they really put ALL markup code into the XSLT. - However, why not? If they have fallback options, it is in any case better than sending the same markup over the wire again and again.

    @RevEng said:
    By the way, this is neither trolling nor sarcastic -- I seriously wonder what the importance of many of these new "web technologies" is, being that I've built several websites lately (freelance and for a few local businesses) and can't imagine how any of these recent technologies (AJAX, SOAP/XML-RPC, XSLT) could help me or my clients.


    I think it really depends on the kind of site you want to build and how much of the content you want to provide for other sites. I think for simple portfolio sites there is very little use. However for interactive pages like forums or services, ajax can improve the user experience significantly (and cut the traffic/load time by a good bit). And if you provide your service as RSS, SOAP or XML-RPC, other people can use your data as the ground for new services ("mash ups").

    Also, the users themselves may be using extensions that can interpret metadata on your site. As far as I know, Microsoft is working on some projects, so that if you for example mark up addresses on your page with some special tags (that have not been developed by them), programs like Outlook could directly copy the adress into an adress book.

    @jeremycc said:
    Does that look easy to understand or follow?  Can you imagine writing or maintaining a whole complex program like this?  XSLT should be used in those limited cases where you are doing simple XML transformations.  Anything else is just unmaintainable.


    So, if I understand you correctly, XSLT is a bad language and generally unmaintainable because the instruction names are too long??? I agree, basing the language on XML was propably not the wisest decision, but seriously, if you argue that way, what is HTML then? I mean, seriously, get yourself a decent editor and be done with it.

    I can see how XSLT "programs" become unmaintainable if you try to shoehorn some imperative program into them. But as far as I understand it, it was always supposed to be a [i]template language[/i] and not something that you implement buiseness logic in.

    At least I can not see how the [i]logic[/i] of that example would be unmaintainable if you take the two minutes time to decipher the parantheses and see what it does.


     



  • My comment was mainly to argue against implementing too much logic in XSLT.  I have seen one or two examples in my regular work life where developers have put way too much logic in XSLT, and it truly bordered on being unmaintainable.  They were literally parsing text using XSLT.

    Anyway, the initial post in this thread made it sound like they were implementing business logic this way, and it just doesn't sound like a good idea.



    And for what it's worth, I think XSLT is a bad language.  I've
    done a lot with it in the past, and I never enjoyed it.  There is just way too
    much visual noise.  Part of what makes a programming language good or
    bad is it's ability to be readable. (IMO)



  • @PSWorx said:

    Care to explain those a bit more?


    I admit, I don't have much "real world" experience, but client-side XSLT seems a really clean and elegant solution to me. And in contrast to several others of the W3's the implementation on the 'web is already somewhat progressed.

    Take a look at the source of this. You can actually use it to make websites already.



    What is the "problem" with HTML/XHTML/CSS that XSLT is trying to solve? XSLT has a place for specific tasks, but as a way to transmit entire data and layout sets to a browser? It's nothing more than a buzzy solution. Kind of like someone throwing AJAX on a website just to have a Web 2.0(tm) website.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.