Working with XSL Style Sheets

If you have no prior experience working with Extensible Stylesheet Language (XSL) style sheets but are reasonably comfortable looking at XML data, you can create your own custom style sheets. There are many books and Internet resources available to help you learn about working with XML data using XSL style sheets.

Important: The following information is intended to give you a basic understanding of the process and is not a complete reference guide.

A good place to start is to export an XML film list and look at it in a text editor. TextEdit can be used to view and edit XML and XSL files, although if you find yourself frequently working with these file types, you should get a specialized application with built-in tools specifically for working with these sorts of files, such as Oxygen or BBEdit.

XML Film List Basics

XML film lists begin with a list of items showing the settings in the Export Film Lists dialog. This is followed by sections for each type of list you included in the film list, such as a cut list and pull list. Each of these list sections include the appropriate events, and each event includes a complete list of the items that Cinema Tools tracks. Following is a simplified example of this structure.

<ctlists> Settings from the Export Film Lists dialog <cutlist> <items> First event Items in this event Second event Items in this event </items> </cutlist> <pulllist> <items> First event Items in this event Second event Items in this event </items> </pulllist> </ctlists>

When you set up a style sheet, you generally start by defining the list information you want to output (cut list, pull list, and so on). You then define the specific items in that list’s events that you want included in the output, such as key numbers and source timecode start and end points.

Pull List Style Sheet Example

A simple style sheet to start out with is the supplied Pull List style sheet. Make a copy of the file (see About Style Sheet–Based Film Lists for details about where to find the file) and give it a name you can easily recognize.

When you open the copy of the Pull List style sheet in a text editor, there are two main sections that appear, with these lines at their head:

  • <xsl:template match="ctlists/pulllist/items">: This section lists the column headings for all of the items that are included in the list. The path that is listed, ctlists/pulllist/items, directs this section to the events in the pull list area of the film list.
  • <xsl:for-each select="pull">: This section lists the specific items in each pull list event to output. (Each event in a pull list is wrapped by a pull element.)

If you want to add or remove an item from the pull list output, you need to make a change to both sections—the first section that controls the column headings and the second section that specifies the data to put under those headings.

For example, if you want this style sheet to output ink numbers and not key numbers, you would make the following changes:

  • In the heading section: Modify the following three lines:
    • Change <xsl:text>Key Prefix</xsl:text>&tab; to <xsl:text>Ink Prefix</xsl:text>&tab;

    • Change <xsl:text>First Key</xsl:text>&tab; to <xsl:text>First Ink</xsl:text>&tab;

    • Change <xsl:text>Last Key</xsl:text>&tab; to <xsl:text>Last Ink</xsl:text>&tab;

    If other names better suit your workflow, you can enter whatever text you like into the data part of these lines. Additionally, if you want to leave the original lines as they are and just add new lines for the ink numbers, you can do that, but keep in mind that this will make the output wider, which could make the output file difficult to print if that’s your final goal.

    Another option is to change the key number–based lines into comments by preceding each line with <!-- and following each with -->. For example, <!--<xsl:text>Key Prefix</xsl:text>&tab;--> is treated as a comment and is ignored when the file is used to process the XML film list.

  • In the item selection section: Modify the following three lines:
    • Change <xsl:value-of select="keyprefix"/>&tab; to <xsl:value-of select="inkprefix"/>&tab;

    • Change <xsl:value-of select="keynumstart"/>&tab; to <xsl:value-of select="inknumstart"/>&tab;

    • Change <xsl:value-of select="keynumend"/>&tab; to <xsl:value-of select="inknumend"/>&tab;

    If you added or removed lines in the heading section, you must add or remove lines in this section as well. The values you use here, such as inkprefix, must exactly match the way they appear in the film list XML file. The order of the items is important as well, because that order determines how the items match the heading names.

After you have modified the Pull List XSL file, you can try it out and verify that you get the correct output.