Adding an <xsl:apply-templates> element to your XSL file

You can add an <xsl:apply-templates> element to your XSL file using the Apply Template wizard. The <xsl: apply-templates> element recursively processes all the children of the source element if a select attribute is not specified. If a select attribute is specified, it will process nodes selected by the select attribute expression instead of processing all the children.

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

Follow these steps to add an <xsl:apply-templates> element to your XSL file. As it is being defined, the <xsl:apply-templates> element will be displayed in a read-only field:

  1. Open your XSL file in the XSL editor.

  2. Click the Snippets tab, open the XSL drawer, and then double-click xsl:apply-templates element.

  3. The match templates in your style sheet will be listed. You can use the value of your match pattern as the value of your select expression if you want to specifically invoke the matched template, or you can use the match pattern as a guide for refining your select expression.

  4. Click xsl:apply-templates in the Parameter list.

    1. The Mode attribute is optional. It is used to provide modularity so that you can group templates together sharing the same value.

    2. The Select attribute is optional. When it is absent, all children of the current node are selected. Otherwise, the nodes matched are determined by the value of the XPath expression in the Select field. To create a value for the Select field you can:

      • Type the XPath expression in this field or

      • Click XPath if you want to use the XPath Expression wizard to create the XPath expression or

      • Select your match pattern in the Select a match pattern field

  5. (Optional) Click the Add Parameter button to add an xsl:with-paramparameter. If you select a match template that already has parameters defined, they will automatically be added to the Parameter list:

    1. Select the parameter you just created.

    2. In the Name field, type the name of parameter.

    3. In the Select field, type the default value of the parameter. Click XPath if you want to use the XPath Expression wizard to create the default value.

  6. Click Finish and the <xsl:apply-templates> element will be inserted into the XSL file.

 

Parent topic

Editing XSL files