Attribute Transformations in Print Publisher

Attribute transformations are frequently used in Print Publisher product templates to change the value of an attribute on a mounted InDesign page into another value, typically into another word or an image. Attribute transformations used with Print Publisher are created in STEP in the same way as those used for other purposes. The difference for print is that these transformations must also be applied to attribute tags on the product template.

This topic does not describe, in depth, how to create attribute transformations in the STEP Workbench. It focuses on attribute transformations intended for InDesign pages. For more information on attribute transformations in general, refer to the Attribute Transformations topic in the System Setup documentation here.

Using an Attribute Transformation to Transform Text in Print Publisher

A common application for attribute transformations in InDesign is to transform a value of 'Yes' into another word. For example, an attribute could indicate whether a product is new or exclusive by having a value of either Yes or No. If the product is new, the value of 'Yes' is mounted on the page, then transformed into the word 'New!'.

The following steps explain how to change an attribute value of 'Yes' into the word 'New!' on an InDesign page using an attribute transformation. The attribute used in this example is named 'Is New?'. This attribute has a validation base type of LOV and uses a Yes/No LOV. If the value is 'No,' then the value will be replaced with nothing, and the text frame will be automatically removed from the page. The removal will occur because the 'Delete no Content' parameter is applied to the text frame on the product template that contains the transformed attribute.

  1. In System Setup, create an attribute transformation following the instructions outlined in the Attribute Transformations topic in the System Setup documentation here. In this example, the transformation has a STEP ID of 'NewItem' and a STEP name of 'New Item'.

  1. Click 'Add Transformation' to launch the Select Transformation dialog. In this example, the 'Replace the whole value' transformation is chosen. Click OK.

  1. Type 'Yes' into the Replace field and 'New!' in the with field.

  1. Click 'Add Transformation' again and choose 'Replace the whole value' again.
  2. In the second transformation row that displays, type 'No' in the Replace field and delete the 'y' in the with field to leave the field blank.

  1. Expand the 'Applies To' flipper and click Add Attribute.

  1. Browse to or search for the relevant attribute in the dialog, then click Select.
  2. The transformation is now applied to the attribute.

If you have an LOV with a large number of values that need to be transformed, recommended practice is to replace all the values using a lookup table instead of creating a separate transformation for each value. For more information, refer to the Transformation Lookup Tables topic in the Resource Materials online help here.

Applying the Transformation to the Product Template

The next step in getting the transformation to work on the mounted InDesign page is to apply the transformation to the relevant attribute tag on the product template. The following steps assume that you have already created a product template and that the STEP Template Content panel is open.

  1. Create a frame on the product template containing the attribute that you applied your transformation to in the workbench. For this example, the attribute is 'Is New?' and the text has been styled bold red within the product template.
  2. With your cursor inside the STEPREF tag, enter the name (not ID) of the relevant attribute transformation in the Transformation field on the STEP Template Content panel and then press Enter. The STEPREF tag on the product template will update with the ID (not name) of your attribute transformation, preceded by the letters TN=, as shown below:

  1. To ensure that the text frame is removed from the page if the value is 'No,' apply the Delete No Content parameter to the frame using the STEP Template Frame panel. For more information on this parameter and panel, refer to the STEP Template Frame topic here.

Testing the Transformation

To ensure that the transformation is working, mount a product using the product template to which you just applied the transformation. If the transformation has not been applied to the attribute correctly, either in STEP or on the product template, the untransformed value will display (in this example, either 'Yes' or 'No').

Testing the Yes Value

  1. Locate a product object in STEP for which the 'Is New?' attribute is valid and make sure that the value of the attribute is 'Yes.'
  2. Locate the object in the STEP Structure View in InDesign and drag it onto the publication template.
  3. The word 'Yes' displays as 'New!'

Testing the No Value

  1. Locate a product object in STEP for which the 'Is New?' attribute is valid and make sure that the value of the attribute is 'No.'
  2. Locate the object in the STEP Structure View in InDesign and drag it onto the publication template.
  3. The frame containing the 'Is New?' attribute is removed from the page and no frame appears.

Using an Attribute Transformation to Transform Text Into an Image in InDesign

Another common application for attribute transformations in Print Publisher is changing a value into an image. For example, an attribute with a Yes/No value could indicate whether a product meets certain criteria that would require an icon to display beside the product.

For this example, the fictional company Acme Faucets sells products that are expected to comply with certain industry and/or government certification standards. Icons appear on the page next to the products that meet these standards. Attributes with Yes/No values are used to control whether or not these icons display. The icons indicate whether the faucets meet the following compliance standards: ADA, Cal Green, NSF Lead-Free, and EPA WaterSense.

Instead of using image reference types to mount these icons onto the page, an attribute transformation changes the value of 'Yes' into the corresponding icon.

The method for transforming an attribute value of 'Yes' into an image on an InDesign page is nearly identical to that used to transform one value into another.

  1. Follow steps 1 and 2 from the 'Using an Attribute Transformation to Transform Text in InDesign' section above to create the attribute transformation and apply the 'Replace the whole value' transformation. (Alternatively, you can also use the 'Replace Substrings of the Value' transformation, and using the substring transformation, you can have a mixture of text and one or more images in the same attribute as described in the 'Example of multiple image tags in attributes' section below. Refer to the Replace Substrings of the Value Example topic in the Data Exchange documentation here.)
  2. In the 'Yes' field of the transformation, enter a tag that references the ID of the image that should appear on the page. The following format is used: <img src="step://asset?id=ADA_Icon">.

ADA_Icon is the ID of the image used in this example:

  1. Apply the transformation(s) to the attribute(s) on the product template following the same method outlined in the 'Applying the Transformation to the Product Template' subsection above. For this example, the frames will look as follows. (All of the transformation tag text does not have to be visible in the frame; the font size has been reduced for this image to display the full text for illustration purposes.)

  1. For the attributes whose values equal 'Yes,' the corresponding icon will mount in the frame. Since the text used in the attribute frames is centered and top-aligned, so are the icons.

  1. If the attribute value is 'No,' the icon will not mount and the frame will be removed from the page. This requires applying the 'Delete No Content' parameter to the text frame, as detailed in the 'Applying the Transformation to the Product Template' subsection above.

Example of multiple image tags in attributes

The images could either be maintained as an Inline Reference, resolving the ID of an asset defined as a character tag, resolving a certain image.

The images are resolved in InDesign via attribute transformations.

If you observe that any mounted attribute value using a 'text to image' attribute transformation shows as requiring update due. it may be due to different markings in the document (typical when upgrading from a lower unsupported version of STEP to a supported version). Update the attribute via a Check DB Update or Update Document Data as a first step to resolving the issue.

Scaling images in transformations

Often, images used in a transformation may be larger than the frames into which the image will display. However, since these images appear in text frames instead of image frames, the scaling parameters available for image frames on the STEP Template Frame panel (e.g., 'Scale Asset to Frame') are unavailable.

Though recommended practice is for the original image to be loaded into STEP at the actual size that is needed, actual-size images are not always available. If the image available in STEP is too large for the frame, the image can be resized within the transformation by adding a dimension value of either width or height to the end of the 'img src' transformation tag. The applied dimension is in points. For example:

<img src="step://asset?id=CalGreen_Icon_Large&width=17">

or <img src="step://asset?id=CalGreen_Icon_Large&height=17">

Note: The transformation tag will accept a value of width or height but not both. However, the image will be sized proportionately regardless of whether width or height is used.

Determine the width / height that you need by changing your measurements in InDesign to points, then selecting the frame.

In this example, the transformation makes the image 17 points wide to give it 1 point of padding inside the frame.

Once the attribute value is transformed, the image is 17 points wide and aligns with the frame identically to how the text was originally placed in the frame. I.e., if the text was centered and top-aligned, the image is as well.

Using Calculated Attributes to Transform Text Into an Image in InDesign

For scenarios on how to transform text into an image on an InDesign page using calculated attributes, refer to the New Product Indicator Scenario topic in the Calculated Attribute Use Cases documentation here.