views:

132

answers:

3

I have seen a lot of job postings for ASP.NET and server engineer positions, and they always seem to list XML and XSLT as one of the skills that is valuable to them. I am wondering what role XML plays in modern systems. How are people using XSLT with XML in nTier systems?

+3  A: 

XML plays two roles in .NET systems: configuration and data-transfer.

By data-transfer I mean that XML is used as a structured form in which data may be placed that needs to be sent from one layer of the application to another (or even between one application and another application altogether). This is usually achieved by means of XML serialization.

Andrew Hare
I must say this answer is really well put, Andrew!
Cerebrus
such as between database layer and business layer? Don't we just have data transfer objects for that?
MedicineMan
@MedicineMan: Are you familiar with SOA?
Andrew Hare
Yes I am. SOA and RESTful interfaces? It seems that SOA uses XML for data transfer when interoperability is important. But I have seen cases where it does not seem like interoperability has any value -- such as internal systems. Can't you just pass simple classes around?
MedicineMan
Of course you can pass objects within an internal system. My point was that once you need to communicate outside the system, XML is .NET's transfer format of choice.
Andrew Hare
+1  A: 

XML is used extensively for SOA communication, particularly when going through firewalls to heterogeneous systems.

WCF and CSLA and all major interop systems always provide XML as one of their cornerstones of communication. You can use binary or other formats in a subset of cases, but XML will always work

Jason Coyne
+6  A: 

Andrew has very succinctly stated the primary roles of XML based data in .NET systems - Providing a templated method for configuration of applications and interoperable transfer of data between disparate platforms.

XSLT being the primary mode of transformation for XML data into XML/XHTML is extensively used because of the same reasons. An XML often needs to be converted to another XML with different structure, or one may want to render an XML datasource directly as HTML output. XSLT is almost indispensable in such cases, even though the transformation could be done manually by writing a lot of DOM traversal code.

Using similar logic, XPath is also used because it provides the most basic and powerful way of traversing the XML hierarchy to query data based on its location in the XML.

Cerebrus
+1 I often forget that XSLT *is* XML - nicely done!
Andrew Hare
I would have thought that in the data access layer, you convert your data to a class, and pass that class up to the business layer. If you pass the XML straight up to the UI, don't we have a case of leaky abstractions?
MedicineMan
Yes, but what if your business layer chooses to serialize your class instances as XML and render them at the UI using XSLT?
Cerebrus
Its not insane at all - it can be a very useful method of displaying report data for instance.
Andrew Hare
Is that a common use of XML, XSLT as well?
MedicineMan
We do XML XSLT transformation all the time, the Bizlayer gives you a Data object, you serialize it, the do xslt transformation, that way you can take the same object and display it any way you want, our top and left menu both have the same data source they are just displayed differently
Bob The Janitor