The Document FactoryThis section illustrates the features of the Document Factory component. The component is a separate BSCW extension package which may not be activated on your BSCW system.
1 Introduction 1 IntroductionThe Document Factory facilitates a comfortable management of document sets which need to be continually revised and periodically published. Based on hierarchically structured templates, documents within such document sets can be automatically created by an evaluation process using the templates. The Document Factory can thereby help to reduce redundancies and to achieve a consistent structure or layout of the documents. The Document Factory provides also an "Export" function which may be invoked to transfer documents within such a document set to an FTP server. The Document Factory is particularly useful for - but not restricted to - Web Site management. 2 Basic ConceptsThe Document Factory is based on the following concepts:
3 Document SetA BSCW Document set is created by selecting the menu entry [ File - New - Document Set ]. A Document Set is represented by the icon. Since a Document Set is similar to a folder, folders (and recursively sub-folders within these folders) may be created within a Document Set. A Document Set also contains BSCW Templates which a user puts into the Document Set or into folders within the Document Set. During the evaluation process, new documents - as specified by the evaluation parameters "document" (see below) - are created which are automatically inserted into the Document Set or into folders within the Document Set. 4 EntitiesEntities are variables within a Document Set. They always have a name and a value. The name consists of a string of alphanumeric characters (a ... z, A ... Z, 0 ... 9). The value is any character string which may also contain references to other entities. Entities can be defined at a Document Set, at folders within a Document Set, or in templates within the Document Set. 4.1 Entity definition for a Document Set or folderFor a Document Set or a folder entities are defined by selecting the menu entry [ - Entities] and then filling a form with the name and value of the entity. 4.2 Entity definition in TemplatesWithin templates, entities are defined with the notation <entity name="name of entity"> 4.3 Entity referencesEntities are references with the notation &(name of entity); References can be made within templates or within entity definitions for a Document Set or a folder. 4.4 Scope of entity definitionsEntities defined at the Document Set can be referenced anywhere from folders or in templates within the Document Set and its folders. Entities defined at a specific folder of the Document Set can be referenced anywhere from folders or in templates subordinate to this folders, i.e., the scope of entities definitions follows the folder hierarchy. Existing entity definitions can be replaced (overridden) by new definitions at subordinate folders or within templates. 5 TemplatesA template is a document of type Document Template (text/x-bscw-template). Such a document should be created with a normal ASCII text editor (e.g.., with MS Windows Notepad), not with a document processing system such as MS Word. When uploading a template document into a Document Set, the Mime Type text/x-bscw-template has to be specified. Otherwise the evaluation process does not recognize the document as a template. It is recommended to use an extension such as '.dtm' for documents of type BSCW Template so they can easily be identified within folder listings by their names. A template is represented by the icon . There are two classes of BSCW Templates: templates of the first class create directly a document during the evaluation process. A template belongs to this class if the evaluation parameter "document" is specified for the template. Templates of the second class contribute indirectly to the creation of a document because they are referenced from other templates. A template belongs to this class if the evaluation parameter "document" is missing. Besides the evaluation parameter "document" there exists also the evaluation parameter "template". Both evaluation parameters specify file names within the Document Set. The following rules apply during the evaluation process: 5.1 Evaluation parameter "document" specified for a template XIn this case the evaluation process will evaluate template X and create a document with the name specified by the parameter "document". In this case, the template consists, in general, out of text and entity references which are resolved from the evaluation process before the document is inserted into the Document Set. 5.2 Evaluation parameters "document" and "template" specified for template XIn this case the evaluation process will evaluate the template specified by the parameter "template" and create a document with the name specified by the parameter "document". During the evaluation process, the entity definitions of template X are used. In this case, the template consists, in general, out of entity definitions, which are inserted into the template specified by the parameter "template" from the evaluation process before the document is inserted into the Document Set. 5.3 No evaluation parameter specified for a template XIn this case the evaluation process will evaluate template X. The name of the document to be created is specified within another template via the parameter "document" and template X is referenced by another template via the parameter "template" (see preceding case 5.2). 5.4 Evaluation parameter "template" specified for a template XIn this case the evaluation process will evaluate the template specified by the parameter "template" (see case 2. above). Template X is referenced by another template via the evaluation parameter "template" (see preceding case 5.2), i.e., at least three templates are involved in the evaluation process. The name of the document to be created is specified within another template via the parameter "document". 5.5 Nested TemplatesTemplates can have references to other templates, i.e., a template can be used by several other templates. A reference to a template is denoted by the following notation : #(name of template)# During the evaluation process the reference to a template will be replaced by the actual text of the template. The reference to a template may also contain path information to locate the template in the folder hierarchy of the document set. Path names are considered relative to the location of the including template. Templates defining entities can also be included in another template. In this case the result of the evaluation process will be inserted (see case 5.4) With #(name of template, name of combined template)# one can define the combined template at the point of inclusion. In this way templates defining entities can be included in various contexts by other templates. Template names may contain the wildcards '*' and '?'. In this case all templates that match the pattern will be included consecutively. For example: #(&(content_dir);/faq/questions*.dtm, &(template_dir);/faq.dtm)# In this case, all templates which are found in the directory &(content_dir);/faq and whose name matches the pattern question*.dtm will be included and combined with the template &(template_dir);/faq.dtm. 6 FunctionsTo insert some environment values during the evaluation process, the document factory provides several functions that can be used in entities or templates:
&base(/home/bscw/www/faq.bht); -> faq
7 Using the Document FactoryTo start with the document factory you have to add a new Document Set with the menu item [ File - New - Document Set ]. There you have to give a name for the new document set and optionally a description. To set entities in the folder hierarchy of a document set use the menu item [ - Entities ]. You can specify the name and the value for a new entity or change an old one. If name field remains empty, the entities will be removed. At templates, i.e. documents of type Document Template (text/x-bscw-template), you set the evaluation parameter with the menu item [ - Eval Parameter ]. This lets you define a template name, with which this template is combined and a document name, if the template should result in a document. Internally the evaluation parameter are entities with the name @template@ respectively @document@. To show all entities at a folder or a template use [ - Show Entities ]. If a name is in italic it is inherit through the directory structure. The operation | evaluate | resp. [ - Evaluate ] starts the evaluation process on the selected objects. For a backup of a document set you can save all entities with [ - Export Entities ]. This generates a file with the following syntax and save it to your local machine: <object path>' = {<entity name>' : '<entity value>',} With the menu item [ - Import Entities ] you can import such backups of the entities. | ||||||||||||||||||||||||||||||||||||||||||||||