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 r with <PERSONA> p -> [<p>[<b>[<i>p]]]) ] | <ACT>[<TITLE> t; rest] -> [ <h3>t !(transform rest with <SCENE>[<TITLE> t (r::Speech|_)+] -> [<h3>t !(transform r with <SPEECH>[<SPEAKER>s ;_] -> [<p>[<b> s]]) ] ) ] ] ] match load_xml "testcases/xslbenchBIGdream.xml" with | x & Play -> print_xml(xslbench4 x) | _ -> raise "Ma che c%$#^# di file mi hai passato?";;