Transformation d'une liste

Serge Leblanc serge.leblanc at wanadoo.fr
Fri Jul 25 11:03:30 CEST 2003


Bonjour à tous,

	j'essaie de compiler cet exemple : 
include "xhtml-strict.cd";;  (* XHTML 1 Strict DTD *)
include "xhtml-categ.cd";;   (* Categories (Inline, ...) from this DTD 
*)
                                                                                             
type Menu_item = <menu_item title=String>String ;;
type Menu_group = <menu_group title=String>[ Menu_item+ ] ;;
type Menu = <menu>[ Menu_group+ ] ;;
                                                                                             
let ligue : Menu_group =
     <menu_group title="La ligue">[
       <menu_item title="Accueil">"Accueil"
       ]
   ;;
                                                                                             
let club : Menu_group =
     <menu_group title="Les clubs">[
       <menu_item title="L'annuaire des clubs de la ligue">"Annuaire"
       <menu_item title="Comment créer un club">"Création"
       ]
   ;;
                                                                                             
let stage : Menu_group  =
     <menu_group title="Les stages">[
       <menu_item title="Le calendrier des stages de ligue">"Calendrier"
       <menu_item title="Comment organiser un stage de 
ligue">"Organiser"
       ]
   ;;

let menu : Menu =
   <menu>[ ligue stage club ]
   ;;
                                                                                             
let transform_menu (Menu_item -> Xdd;
                     Menu_group -> [ (Xdt | Xdd)+ ];
                     Menu -> Xdl )
   | <menu_item title=t>s -> <dd>[ <a title=t>s ]
   | <menu_group title=t>g -> [ <dt>[ <b>t ] !(map g with i -> 
transform_menu i) ]
   | <menu>m -> <dl>(map m with g -> transform_menu g)
   ;;

transform_menu menu ;;

-------
J'obtiens l'erreur suivante :
	 
Error at line 39 (chars 36-52), file ./ldsab/test2.cd:
This expression should have type:
Xdt | Xdd
but its inferred type is:
[ (Xdt | Xdd)+ ]
which is not a subtype, as shown by the sample:
[ <dt {| title =? Empty; id =? Empty; dir =? Empty; xml:lang =? Empty;
       lang =? Empty; onkeyup =? Empty; onkeydown =? Empty;
       onkeypress =? Empty; onmouseout =? Empty; onmousemove =? Empty;
       onmouseover =? Empty; onmouseup =? Empty; onmousedown =? Empty;
       ondblclick =? Empty; onclick =? Empty; style =? Empty;
       class =? Empty |}>[  ] ]


Je ne parviens pas à trouver une solution. Pouvez-vous m'aider ?

-- 
Serge Leblanc
110 rue de charnècles
F-38340 Voreppe
France
phone: 06 23 22 55 58
GnuPG Key ID : 73791C2B
fingerprint = 8E0C 0D6D E026 A278 9278  BF4F 1A93 D552 7379 1C2B
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listes.math.univ-paris-diderot.fr/pipermail/cduce-users/attachments/20030725/c0eda22d/attachment.bin>


More information about the Cduce-users mailing list