Commit c2d7ef32 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-02-05 22:20:04 by cvscast] Empty log message

Original author: cvscast
Date: 2003-02-05 22:20:04+00:00
parent 0be2d6a0
......@@ -4,16 +4,16 @@ type Flow = Char | Block | Inline | Misc;;
type Block = P | Heading | Div | Lists | Table | Blocktext;;
type Lists = Ul;;
type Blocktext = Pre | Hr | Blockquote | Address;;
type Inline = Char | A | Special | Fontstyle | Phrase;;
type Inline = Char | A | Special | Fontstyle | Phrase ;;
type Fontstyle = Tt | I | B | Big | Small;;
type Phrase = Em | Strong | Code;;
type Special = Br;;
type Misc = Empty;;
type Html = <html>[ Head Body ];;
type Head = <head>[ Title ];;
type Head = <head>[ Title <link>[ ]];;
type Title = <title>[ PCDATA ];;
type Body = <body bgcolor=String>[ Block* ];;
type Body = <body bgcolor=?String>[ Block* ];;
type Div = <div>[ Flow* ];;
type P = <p>[ Inline* ];;
......@@ -45,15 +45,15 @@ type Table = <table border=?String; bgcolor=String; width=String>
(* The type of the documents *)
type Book = <book>[ Title Author Chapter+ ];;
type Title = <title>String;;
type Author = <author>[ Name Address Salary ];;
type Author = <author>[ Name HomeAddress Salary ];;
type Name = <name> String;;
type Address = <address> String;;
type Salary = <name> Int;;
type Chapter = <chapter title=String>[Section+];;
type HomeAddress = <home> String;;
type Salary = <euros> String;;
type Chapter = <chapter title=String>[Intro Section+];;
type Intro = <intro> String;;
type Section = <section title=String>[(Content | Subsection)+];;
type Content = Char | Image | Formula | Outline;;
type Image = <img src=String; style=String; size=String >[ ];;
type Image = <img src=String; style=?String; size=?String >[ ];;
type Formula = <math>[ Expr* ];;
type Expr = <mi>String
| <mo>String
......@@ -64,23 +64,50 @@ type Outline = <outline>[(Char | Formula)+];;
let book =
match load_xml "livre.xml" with
| Book & <_>b -> b
| _ -> raise "Document non valide";;
let src =
match [ (load_xml "livre.xml") ] with
| XML & x -> x
| _ -> raise ("Invalid input ...");;
let out : String =
[ '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
let src : Html =
let [ <title>title
<author>[<name>name ;_]
<chapter title=ct>[ <intro>i <section> history (sections::_*) ] ;_
] = book in
<html xmlns="http://www.w3.org/1999/xhtml">[
<head>[ <title> title
<link rel="stylesheet"; href="livre.css"; type="text/css">[ ]
]
<body>[
<div class="title">[ <h1>[ !ct] ]
<div id="Sidelog">[
<b>[!title] ' par ' <i>[!name]
<div class="box">[] (*toc*)
<div class="box">history (*history*)
]
<div id="Content">[
<div class="box">[] (* intro *)
]
]
];;
let page : String =
[ '<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
<!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
]>']
@
(transform convert src with
(transform [src] with
x -> print_xml x);;
dump_to_file "index.xml" out;;
dump_to_file "index_test.xml" page;;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment