<x>1</x>
<x>4</x>
</Param>
<Session>
<v>4</v>
</Session>
<Cookie>
<content>apple jam</content>
<JServSessionIdroot>aaenbyjqc0</JServSessionIdroot>
</Cookie>
</Request>
После того как генерация документа завершена, к нему применяется преобразование stylesheet.xsl
, которое создает его HTML-представление.
<xsl:stylesheet
version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match='Request'>
<html>
<head>
<title>Request information</title>
</head>
<body><xsl:apply-templates mode='table'/></body>
</html>
</xsl:template>
<xsl:template match='*' mode='table'>
<h1><xsl:apply-templates select='.' mode='header'/></h1>
<table><xsl:apply-templates mode='row'/></table>
</xsl:template>
<xsl:template match='General' mode='header'>
<xsl:text>General information</xsl:text>
</xsl:template>
<xsl:template match='Param' mode='header'>
<xsl:text>Request parameters</xsl:text>
</xsl:template>
<xsl:template match='Session' mode='header'>
<xsl:text>Session parameters</xsl:text>
</xsl:template>
<xsl:template match='Cookie' mode='header'>
<xsl:text>Cookies</xsl:text>
</xsl:template>
<xsl:template match='*' mode='row'>
<tr>
<td><xsl:apply-templates select='.' mode='name'/></td>
<td><xsl:value-of select='.'/></td>
</tr>
</xsl:template>
<xsl:template match='*' mode='name'>
<xsl:value-of select='name()'/>
</xsl:template>
<xsl:template match='General/ServerName' mode='name'>
<xsl:text>Server name</xsl:text>
</xsl:template>
<xsl:template match='General/ServerPort' mode='name'>
<xsl:text>Server port</xsl:text>
</xsl:template>
<xsl:template match='General/RemoteAddr' mode='name'>
<xsl:text>Remote address</xsl:text>
</xsl:template>
<xsl:template match='General/RequestURI' mode='name'>
<xsl:text>Request URI</xsl:text>
</xsl:template>
<xsl:template match='General/QueryString' mode='name'>
<xsl:text>Query string</xsl:text>
</xsl:template>
</xsl:stylesheet>
Результатом этого преобразования является следующий HTML-документ, внешний вид которого полностью идентичен документу, показанному на рис. 9.13.
<html>
<head>
<title>Request information</title>
</head>
<body>
<h1>General information</h1>
<table>
<tr>
<td>Server name</td>
<td>aphrodite.fzi.de</td>
</tr>
<tr>
<td>Server port</td>
<td>80</td>
</tr>
<tr>
<td>Remote address</td>