RenderObjects stylesheet structure

Stylesheet structure

The "pFetchInfo" JSONValue object passed to the constructor must contain at least one "fetch stylesheet". It may also contain at most one "dictionaries" key.

The "dictionaries" key, when present, must point to a JSON object which maps strings to JSON objects, which in turn map strings to strings (only). It is used for looking up things in a dictionary with a special template tag called "dictlookup".

Moreover, the name of the stylesheet passed in the last parameter to the constructor must be present in the pFetchInfo JSON object as a key, which names a "fetch stylesheet". The value of this key must, in turn, be a JSON object. This JSON object must, in turn, contain at least the key, "object_types". It may also contain the keys "priority_list", "postprocess", and "prepend_XML_declaration".

The "object_types" key must point to a JSON object.

The "priority_list" key, when present, must point to a list of JSON strings.

The "postprocess" key, when present, must point to a list of JSON objects. It is used for doing any post-processing after the renderobjects process proper has finished.

The "prepend_XML_declaration" key, when present, must point to a JSON Boolean. Unless this is present, and false, the following string is prepended to the output: "<?xml version='1.0' encoding='utf-8'?>". Thus you can turn off this "feature" by having this key/value pair in your stylesheet:

       "prepend_XML_declaration" : false,

For examle, the following would be the beginnings of a "fetch stylesheet", with one stylesheet called "base":

{
   "fetchinfo" : {
      "base" : {
         "object_types" : {
         },
         "priority_list" : [
         ],
         "postprocess" : [
         ],
         "prepend_XML_declaration" : true,
      }
   }
}

priority_list

There are two ways of telling Emdros in which order to process the objects retrieved. One is by means of a "document index feature". Here we describe the priority list. The document index feature will be described later.

The "priority_list" must contain a list of JSON strings, each of which is the name of an object type. If an object type name occurs in the "priority_list", it must occur in the "object_types" JSON object.

The purpose of the "priority_list" is to indicate the order in which the object types must be processed. (See below for the processing model.)

object_types

The "object_types" JSON object must contain key/value pairs as follows:

  • Keys: object type names
  • Values: A JSON object with the following keys: "start", "end", "get", and "docindexfeature". All of these are optional, but if anything is to happen with the objects from the object type, then at least one of "start" and "end" must be present. They are explained below.

Example

Thus, a simple but complete example of a stylesheet with one "fetch stylesheet" and the "dictinoaries" key may look like this:

{
   "fetchinfo" : {
   {
      "base : {
         "object_types" : {
             "document" : {
                  "start" : "<document id=\"{{ feature 0 }}\"><docname>{{ dictlookup 'documentname' feature 0 'Unknown document' }}</docname>",
	          "get" : [
	             "documentid"
	          ] 
                  "end" : "</document>"
              },
              "token" : {
                   "get" : [ "surface" ],
                   "start" : "<token>{{ feature 0 }}</token>"
              },
         },
         "priority_list" : [
            "document",
            "token"
         ],
     },
  }
  "dictionaries" : {
     "documentname" : {
         "id123" : "Alice's adventures in wonderland",
         "id456" : "Moby Dick",
     }
  }
}

Previous:RenderObjects
Up:RenderObjects
Next:RenderObjects processing model