Share via


Deploying XSLT on the Server

 

Server-side transformation of XML with Active Server Pages (ASP) is a viable solution for sending HTML to down-level (less capable) browsers. To avoid the incompatibility of different versions of MSXML, use version-dependent ProgIDs from within the page to link your XSLT style sheets with source XML documents.

Advantages of Transforming on the Server

Transforming the content on the server has the following advantages.

  • Single Point of Entry. Because the server can determine the client capabilities, the same page can service any kind of device, and can also consolidate a number of sections on the site into a single manageable interface.

  • Smaller Downloads. You send to the client only the minimum amount of code necessary to display the page. Script, in particular, can be significantly reduced.

  • Error Control. It is easier to handle errors transparently on the server than it is on the client.

  • Data Access and Security. Data access on the client is an expensive operation, because it involves not just moving information but also controlling access. By moving much of this to the server, you can effectively limit the amount and type of information that needs to be sent.

  • Reduced Coding. You can reuse existing blocks of both scripting and markup code. This makes it possible to create web pages more quickly.

  • Better Content Management. By keeping your transformations on the server, you can more effectively integrate documents transparently. This means that users see only a complete document, not the various sub-documents that generate the document. This also makes it easier to make major changes to pages without disrupting the underlying content.

  • Stability of Platform. With server-side content generation, you have complete control over the platform used to create the output. This means that you do not have to worry as much about versioning issues, problematic memory situations, and instability of the client. You can also plan your code resources more intelligently, and use features such as Microsoft Transaction Server (MTS) to better distribute your internal resources.

  • Business Logic. If most of your data is XML-based, XSLT makes a very effective tool for writing business logic to both validate and manipulate the XML. Because business logic typically involves proprietary (and potentially insecure) information, performing these transformations on the server can give you improved performance and security.

Disadvantages of Transforming on the Server

The major disadvantage to using XSLT on the server is that state management becomes more problematic. Because you can save XML code in server-side session variables, this can have an adverse impact on performance (especially when dealing with Web forms). Therefore, XSLT solutions should be largely stateless. (Some possible exceptions are cookies, query and form string parameters, and similar lightweight state tokens.)

Another solution for handling state is to look at such solutions as the Simple Object Access Protocol (SOAP). SOAP has rapidly become the protocol of choice for exchanging messages between components outside of Windows proper, and can also be used internally through such services as Microsoft® C#™ and Visual Studio® 7. Because SOAP is an XML protocol, it can also be manipulated with XSLT, making XSLT-oriented messaging systems feasible.

See Also

Deploying XSLT in Internet Explorer
Deploying XSLT on the Client