Commit 762270b5 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-06-30 14:29:07 by cvscast] Empty log message

Original author: cvscast
Date: 2003-06-30 14:29:07+00:00
parent 437a9237
......@@ -3,8 +3,6 @@
simplified definition of Xhtml
*)
type Flow = Char | Block | Inline ;;
type Block = P | Heading | Lists | Blocktext | Char
type Lists = Ul
......@@ -34,6 +32,7 @@ type B = <b>[ Inline* ];;
type Big = <big>[ Inline* ];;
type Small = <small>[ Inline* ];;
(* xtransform matches the patterns against the root element of each
XML tree and, if it fails, it recursively applies itself to the
sequence of sons of the root.
......@@ -42,11 +41,9 @@ type Small = <small>[ Inline* ];;
document as follows
*)
let bold(x:[Xhtml]):[Xhtml]=xtransform x with <a (y)>t -> [ <a(y)>[<b>t] ]
(* let us apply the function to a document where links appear
at different depths
*)
......@@ -57,7 +54,7 @@ let doc : Xhtml =
<head>[<title>"Example" <link>[]]
<body>[
<h2>['You can have links ' <a href="here">"here"]
<p>['Or they can be down']
<pre>['Or they can be down']
<ul>[
<li>['In ' <a name="list">"lists" ' for instance']
<li>['or you oddly decided to '
......@@ -65,15 +62,19 @@ let doc : Xhtml =
' them '
]
]
<address>[
<address>[
'and even if they are in fancy ' <a name="address">"address boxes"
]
<p>[
'nevertheless ' <a href="http://www.cduce.org">"Cduce" ' and '
<a href="xtransform">[<tt>"xtransform"]
' will put all links in bold so that when'
' you program your transformation you '
<big>[<a name="">" don\'t " ] ' have to worry about it'
]
<p>['nevertheless ' <a href="http://www.cduce.org">"Cduce" ' and '
<a href="xtransform">[<tt>"xtransform"] ' will put all links in bold ']
]
]
];;
bold [doc];;
match
let [x] = bold [doc] in print_xml x;;
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