[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: LINQ to XML versus XSLT

Subject: Re: LINQ to XML versus XSLT
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Fri, 27 Jun 2008 15:30:44 +0100
Re:  LINQ to XML versus XSLT
--------------------------------------------------
From: "Alexander Johannesen" <alexander.johannesen@xxxxxxxxx>
Sent: Friday, June 27, 2008 3:20 PM
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re:  LINQ to XML versus XSLT

On Fri, Jun 27, 2008 at 15:53, Joe Fawcett <joefawcett@xxxxxxxxxxx> wrote:
True but in LINQ's defence it is declarative, in the same mould as SQL.

Really? By that token, all queries are declarative. In my world, declarative approaches deal more with expected outcome rather than querying known structures (i.e. XSLT matching does not require knowledge of the data model, whereas a query like SQL requires it).

Anyway, I find both LINQ and the XML API non-elegant, like a hack on
C# with an API of sorts instead of extending the language with native
XML support. Why no language hasn't got XML as a native datatype yet
is the truly absurd thing. Everybody use XML, yet no language has got
it in its fabric. In other words, why ;

XElement contacts =
  new XElement("contacts",
     new XElement("contact",
        new XElement("name", "Patrick Hines"),
        new XElement("phone", "206-555-0144"),
        new XElement("address",
           new XElement("street1", "123 Main St"),
           new XElement("city", "Mercer Island"),
           new XElement("state", "WA"),
           new XElement("postal", "68042")
        )
     )
  );

when you could do ;

result =
  <contacts>
     <contact>
        <name>Patrick Hines</name>
        <phone>...</phone>
        ...
     </contact>
  </contacts> ;

or ;

result = <root><name>{$some.variable}</name></root> ;

or ;

result =
  <root>
    <xsl:for-each select="{$some.list}">
       <name>{name}</name>
    </xsl:for-each>
  </root> ;

Fiddling around with the various APIs we're currently doing is *so*
1999. Time to move on, no? Put the beauty of XSLT in your languages
already.


Alex --
Well you can do either of those first two syntaxes in VB.NET and a variant on the third.

When I said declarative I meant from/where/select syntax as shown in this posting: http://chaddalton.com/blog/post/2848/


Joe
http://joe.fawcett.name


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.