dbonerow.cd 1.79 KB
Newer Older
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

type Table = <table>[Row*] ;;
type Row = <row> [
  <id>[PCDATA]
  <firstname>[PCDATA]
  <lastname>[PCDATA]
  <street>[PCDATA]
  <city>[PCDATA]
  <state>[PCDATA]
  <zip>[PCDATA]
] ;;

include "../../web/xhtml-strict.cd" ;;


let fun dbonerow (<table> x : Table) : Xhtml = 
<html>[
  <head>[<title>"Dbonerow test"]
  <body>
     (transform x with
       <row>[<_>("0432"&id) <_>fn <_>ln <_>st <_>city <_>state <_>zip ] -> 
         [<table border="0";style="background-color:#888888">[
            <tr>[
                 <td colspan="2";style="background-color:#000000; color:white">
                 (*<font color="#ffffff"> deprecated in Xhtml strict*)
                 ("personel record #" @ (id))                  
            ]
            <tr>[
               <td style="background-color:#888888"> "First Name:"
               <td style="background-color:#dddddd"> fn
            ]
            <tr>[
               <td style="background-color:#888888"> "Last Name: "
               <td style="background-color:#dddddd"> ln
            ]
            <tr>[
               <td style="background-color:#888888"> "Street: "
               <td style="background-color:#dddddd"> st
            ]
            <tr>[
               <td style="background-color:#888888"> "City: "
               <td style="background-color:#dddddd"> city
            ]
            <tr>[
               <td style="background-color:#888888"> "State: "
               <td style="background-color:#dddddd"> state
            ]
            <tr>[
               <td style="background-color:#888888"> "Zip: "
               <td style="background-color:#dddddd"> zip
            ]
          ]
        ]
     )
]
;;




61
match load_xml "testcases/db30000.xml" with
62
  | x & Table -> print_xml(dbonerow x)
63
64
65
66
67
  | _ -> raise "Ma che c%$#^# di file mi hai passato?";;