Skip to main content

Dynamic Reusable Object sample

Maxime avatar
Written by Maxime
Updated over 3 weeks ago

The attached project contains :

\template\DynSRO.scd : This template uses a data file which contains a list of sro's to be included.
\template\reusable-objects-index.xml : This xml file is a list of available sro's, all sro's that possibly could be included, should appear in this list.
\sro : This directory contains the sro's that can be included
\data : This directory contains 2 different data files that can be used with the template, they both include a different set of sro's.

This is how the sample works :

The template contains a container which repeats based on the sro element in the data. Inside the container an XSL Script object exists, which retrieves the list of sro's to be included, from the XML data source. Using the reusable-objects-index.xml, the correct sro is selected and included in the output.

In the 'withdata' sample, the first reusable object uses data that is being replaced by data from the template. This is driven by the following line in the XSL Script :

<xsl:with-param name="document0" select="{.}"></xsl:with-param>

The document0 reflects the name of the data source that is used internally in the sro. You can retrieve this name by generating XSLT+XSL-FO from the template using the sro. The name is registered in the definition of the sro in the template.

Did this answer your question?