type Play = [ Title Header Personae String String Act+] type Title = String type Header = <FM>[(<P>String)*] type Personae =<PERSONAE>[Title (Persona | Pgroup)+] type Pgroup = <PGROUP>[Persona Persona+ <GRPDESCR>String] type Persona = <PERSONA>String type Act = <ACT>[ Title Scene+ ] type Scene = <SCENE> [Title (Stagedir | Speech)+] type Speech = <SPEECH>[<SPEAKER> String (Line |Stagedir)+] type Stagedir = <STAGEDIR> String type Line = <LINE> [(Char |Stagedir)+];; include "../../web/xhtml-strict.cd" ;; let fun xslbench4 (Play -> Xhtml) <PLAY>[<TITLE>title; rest] -> <html>[ <head>[<title>title] <body>[ <h1> title !transform rest with | <FM> x -> [<p>[<i>(transform x with <P> y -> y)]] | <PERSONAE>[<TITLE> t ;r] -> [ <h2>("Parts - "@t) !(transform r with | <PERSONA> p -> [<p>[<b>[<i>p]]] | <PGROUP> x -> transform x with <PERSONA> p -> [<p>[<b>[<i>p]]]) ] | <ACT>[<TITLE> t; rest] -> [ <h3>t !(transform rest with <SCENE>[<TITLE> t (spches::Speech|_)+] -> [<h3>t !(transform spches with <SPEECH>[<SPEAKER>s (lines::<LINE>_|_)*] -> [<p>[<b> s <br>[] !transform lines with <LINE>[(str::Char |_ )+] -> [!str <br>[]]] ] ) ] ) ] ] ] match load_xml "testcases/xslbenchdream.xml" with | x & Play -> dump_to_file "xslbench2.htm" (print_xml(xslbench4 x)) | _ -> raise "Ma che c%$#^# di file mi hai passato?";;