AJAX Pattern: Xsl Message
 |
Messages between browser and server contain XSL.
Frequency of use:
low
|
|
 |
XSL is a specification for transforming XML into another document format, such as
RTF (Rich Text Format) or HTML. XSL Transformation (XSLT) is supported by most browsers but the API
differences are significant which requires that you to write browser specific code.
Sending XSL messages to the client and performing XSLT on the browser is
rarely done. Performing the XSL transformations on the server before
sending it out usually produces more efficient and more robust code.
This example displays a list of products from the database.
When the page is first loaded, the data is embedded in the page as an XML Data Island
(XML Data Islands can be considered an AJAX pattern as well).
Then, one of 4 different XSL stylesheets is retrieved from the server
and applied to the XML data in the XML Data Island.
The XSLT performs the transformation of the data into the requested report format.
All XML and XSL Transformations take place on the client
using JavaScript. However, in most circumstances it is preferable to transform the
data on the server and send the rendered HTML to the client.
Example: Product Report Formatting
69
2-Port KVM With Cables
2 lbs
$19.99
26
11
5-Port 10/100 NWay Switch
1 lbs
$19.99
22
67
AlienWare AMD 1.8 Ghz
29 lbs
$914.00
5
52
Astar PD-3020 DVD Player
2 lbs
$99.99
38
61
BlackBerry 7100G
1 lbs
$699.90
113
56
Coby 300Watt DVD Home Theater
2 lbs
$64.99
21
28
ConvertX PX-AV100U
4 lbs
$44.75
4
15
Dell Axim X51v
1 lbs
$499.00
39
44
Dell Axim X51v Handheld 416 MHz
1 lbs
$397.00
27
43
Dell Dimension 4100
20 lbs
$1,446.00
17
70
Dell XPG 2Gh
45 lbs
$1,115.00
12
12
D-Link 24-Port Switch
1 lbs
$794.99
86
33
D-Link 48-Port Switch
2 lbs
$334.99
112
34
Fujitsu 1.86 Gh Notebook
24 lbs
$1,295.99
33
24
Fujitsu Centrino 1.8 Gh
33 lbs
$2,090.50
16
35
GQ Pentium M 1.5 GHz Notebook
26 lbs
$2,000.00
20
50
Hitachi / 400GB / 7200 / 8MB
1 lbs
$279.99
44
26
Hitachi / 80GB / 7200 / 2MB
1 lbs
$59.99
15
21
Hitachi / 80GB / 7200 / 2MB
1 lbs
$59.99
49
62
Hitachi / Deskstar 7K500 / 500GB
1 lbs
$359.99
17
23
HomeMix CDJ-1 Dual CD-Player
1 lbs
$99.99
61
5
HP iPaq 3715
1 lbs
$449.99
0
66
HP iPaq HX2410 128MB
1 lbs
$394.99
4
17
HP iPAQ PDA Cell Phone for T-Mobile
2 lbs
$599.99
0
6
HP iPaq rx3115 Pocket PC
1 lbs
$299.99
120
2
HP z555
21 lbs
$1,599.00
17
75
IBM ThinkCentre A Series
44 lbs
$2,227.75
44
76
IBM ThinkPad Z Series
19 lbs
$2,298.00
57
46
IBM ViaVoice Standard Edition V10
1 lbs
$44.99
95
63
I-Mate PDA2K Compact PDA
1 lbs
$824.99
24
36
Internet Security Suite
1 lbs
$61.99
112
14
Iomega 16x Video Capture
3 lbs
$149.99
4
60
Linksys 10/100 Mbps Router
1 lbs
$66.99
19
42
Maxent DVD Recorder
2 lbs
$79.99
26
25
Maxtor / 80GB / 7200 / 8MB
1 lbs
$59.99
44
19
Maxtor / DiamondMax 10 / 160GB / 7200
2 lbs
$49.99
25
47
Maxtor / DiamondMax 10 / 300GB / 7200
1 lbs
$89.99
33
73
Microsoft Money 2005 Deluxe
2 lbs
$53.99
101
40
Microsoft Money 2005 Standard
1 lbs
$26.99
123
18
Microsoft Office 2003 Pro
2 lbs
$449.99
42
77
MIO 269 2.5GB Mobile
1 lbs
$575.95
32
53
Motorola A1000 Camera Phone
2 lbs
$649.99
0
9
Motorola A1000 Camera Phone
2 lbs
$649.99
3
72
Netgear 16-Port Switch
2 lbs
$39.97
14
59
Netgear 16-Port Switch
2 lbs
$39.99
79
71
Netgear 5-Port Switch
1 lbs
$10.99
26
54
Nokia 7710 GSM Phone
2 lbs
$499.99
2
30
Office 2003 Upgrade
1 lbs
$205.99
10
22
Optoma DVD Projector
8 lbs
$1,499.99
104
3
Palm IIIxe Refurbished
1 lbs
$69.99
13
Click here to view the source code.