Returning XML in the Raw
An interesting use case for the XSLT Viewis actually to avoid transforming the XML at all and
simply return it raw. You can easily achieve this by opting notto specify a value for the
stylesheetLocationproperty on your View.
Figure 8-7 shows the output of our home page after we comment out the
stylesheetLocationproperty in views.properties.
Figure 8-7.XML output in the client
Why would you want to do such a thing? It’s possible that your application’s clients are not
humans but rather machines. In the simplest case, you could be providing something like an
RSS feed for news clients.
Larger systems might use it as a decoupling strategy. The view layer from one part of the
service emits a known XML variant so that it can be used as input by one or more content ren-
dering engines (CREs). These CRE applications are then free to concentrate on generating the
actual end product—probably for multiple device types and languages. Separation of con-
cerns at a higher level!
Other Noteworthy XSLT Features
Before we move on, it’s worth mentioning a couple of other features specific to Spring’s
XML/XSLT support. We’ll take a brief glance at number and date formatting and stylesheet
parameterization.
254 CHAPTER 8 ■SUPPORTED VIEW TYPES