-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshoppingcart_checkout_xslt.xsl
88 lines (85 loc) · 2.68 KB
/
shoppingcart_checkout_xslt.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Exempel:
<book>
<id>1</id>
<title>Javaprogramming</title>
<authorname>Fredrik</authorname>
<authorsurname>Alund</authorsurname>
<price>23</price>
<pages>234</pages>
<description>Bla bla bla</description>
</book>
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="checkout">
<html>
<head><title>BookShop::Checkout</title></head>
<body>
<table border="0" cellspacing="0">
<tr bgcolor="silver">
<td colspan="4">
<strong>Shoppingcart</strong>
</td>
<tr bgcolor="silver">
<td>Title</td>
<td>Quantity</td>
<td colspan="2">Remove</td>
</tr>
</tr>
<xsl:apply-templates select="shoppingcart/order"/>
</table>
<table border="0">
<form action="shop" method="post">
<input type="hidden" name="action" value="save" />
<tr>
<td>Name:</td>
<td><input>
<xsl:attribute name="type">text</xsl:attribute>
<xsl:attribute name="name">shipping_name</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="name"/></xsl:attribute>
</input></td>
</tr>
<tr>
<td>Address:</td>
<td><input>
<xsl:attribute name="type">text</xsl:attribute>
<xsl:attribute name="name">shipping_address</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="address"/></xsl:attribute>
</input></td>
</tr>
<tr>
<td>Zip code:</td>
<td><input>
<xsl:attribute name="type">text</xsl:attribute>
<xsl:attribute name="name">shipping_zipcode</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="zip"/></xsl:attribute>
</input></td>
</tr>
<tr>
<td>City:</td>
<td><input>
<xsl:attribute name="type">text</xsl:attribute>
<xsl:attribute name="name">shipping_city</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="city"/></xsl:attribute>
</input></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Buy" /></td>
</tr>
</form>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="shoppingcart/order">
<tr>
<td>
<xsl:value-of select="book/title"/>
</td>
<td align="right">
<xsl:value-of select="quantity"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>