Documentation Center

Adding a generic form to a publication

In a publication, create an XML file that represents a generic form, and XSL stylesheets to transform the form.

Procedure

  1. Navigate to the templates/FullSupport/httpdocs/book_data/COLLECTION/PUBLICATION/genforms/ subdirectory of the LiveContent S1000D home directory, where COLLECTION is the name of your collection and PUBLICATION is the name of the publication to which you want to add your generic form.
  2. Create a subdirectory called newform/ and navigate into it.
  3. Create a new XML file in an editor.
  4. Fill the file with the definition of the structure of your form. You can use the two existing sample forms in the Bike sample to help you get started.
  5. By default, a title for this form is generated based on the form name and sample date, for example, "Warranty Registration - 06/12/2014 0 10:13 AM". If you want to prompt the user for a title instead, ensure that your XML file includes the following:
    <input type="text" id="form_title" required="true" size="34"/>
  6. Save your XML file in the new newform/ subdirectory as newform.xml.
  7. Create XSL templates that transform your XML form into an HTML user interface for the user to fill in. Save any XSL templates that are specific for this form in a new file called newform.xsl. Save any XSL templates that are generic and can be shared across all generic forms in a new or existing file called genforms.xsl, which must reside in the parent directory, genforms/.
  8. Create an XSL-FO stylesheet that transforms your XML form and the data filled in into a PDF document that the user can print.
  9. In this stylesheet, directly below the <xsl:stylesheet> start tag, add the following:
    <xsl:param name="filter_location" />
    <xsl:param name="filtervars" select="document($filter_location)/form-instance/form-data" />

    and use the declared $filtervars variable to access the form data entered by the user.

  10. Save this XSL-FO stylesheet in the newform/ subdirectory as newform_pdf.xsl.

What to do next

Once a user has filled in a form, you can view an example of the XML document captured in $filtervars, and which represents the form data, by navigating to the working/genforms/COLLECTION/PUBLICATION/USER/newform/ subdirectory of the default collection directory, where COLLECTION is the name of your collection, PUBLICATION is the name of the publication, and USER is the name of the user who filled in the form.