Creating New Doctypes with Apache Lenya
Hello,
This is a little tutorial about how to create a new Doctype with Apache Lenya. I have being working with this great tool 2 years now and I know the kinds of problems you kind find when creating a new Doctype. I believe that is because there is not much information on the web about it. So that’s what’s this all about, a little help for Lenya users.
CREATING A NEW DOCTYPE
First of all I will assume that you have already installed one version of Apache Lenya.
Now, let’s say we want to create the doctype : basic
Ok then, to create a new doctype you must follow this steps:
- The first step is to create the xml of the doctype and name it: basic.xml and save it in the folder:”\webapps\lenya\lenya\pubs\{yourPub}\config\doctypes\samples\”
I assume you know XML, if not there are plenty of tutorials on the Web. Anyway you can download mine in the link shown at the bottom. - Place the RelaxNG file with the name: “basic.rng” in the folder: “\webapps\accesible\lenya\pubs\{yourPub}\config\doctypes\schemas”
I assume as well that you know how to create a RelaxNG file, if not you can use mine as I guide that’s available in the link at the bottom - Add your XSL file with the name: “basic2xhml” in the folder: “\webapps\lenya\lenya\pubs\{yourPub}\xslt”
- Edit the file : “doctypes.xconf” that’s in: “\webapps\lenya\lenya\pubs\{yourPub}\config\doctypes\” and add a new “doc” element with the doctype name: “basic” and the sample-name: basic.xml.
This will tell lenya there’s a new doctype available - Edit the file: “generic.xsp” that’s in: “webapps\lenya\lenya\pubs\{yourPub}\config\menus\” and add a new “item” element with this atributes: uc:usecase=”create” uc:step=”showscreen” href=”?doctype=basic”. And the “i18n” element with the value: “New document basic”
This will add a reference to create a document with the “basic” doctype in the Edit menu. - Edit the file: “parameter-doctype.xmap” that’s in: “\webapps\lenya\lenya\pubs\{yourPub}\” add a new sourcetype element with the name attribute: “basic” and a “document-element” with the namespace: “http://www.salvador.com/basic”. It is important that the namespace you add here matches the one you have in you XML an RNG file. You can guide yourself with the one that Lenya has
- Edit the file: “content-namespaces.xml” that’s in: “\webapps\lenya\lenya\resources\misc\bxeng” and add a “xmlns” element with the value: “basic=http://www.salvador.com/basic”
- Ok, almost over now, the next step is to create the file: “basic-namespaces.xml” with the content that has the elements:
“namespaces” and inside the “xmlns” element with the value:”basic=http://www.salvador.com/basic” and save it in: “\webapps\lenya\lenya\pubs\{yourPub}\resources\misc\bxeng” - Finally create the:”basic-bxeng.css” file with the style you wish and save it on the same folder as above. This is jsut for the Bitflux editor.
Uff that’s a full one isn’t it? Well I hope this helps somebody ! Any comment or question please let me know I will be glad to help.
regards,
Salvador