PageRenderException: Could not transform with Script format

When previewing a page, you may see a full-page error of the type Could not transform with Script format... . This indicates that a Format responsible for rendering part of the page's content is encountering an error.

The path to the Format in question will be included in the first half of the error. The second half of the error lets you know what type of error is being encountered. Here are some common Format error types:

Element type "img" must be followed by either attribute specifications, ">" or "/>".

Example:

An error occurred: com.hannonhill.cascade.model.render.page.PageRenderException: Could not transform with Script format "path/to/format": Error on line #: Element type "img" must be followed by either attribute specifications, ">" or "/>".

This indicates that an image tag in a format is being interrupted from closing by an unescaped character such as a quotation mark. This can often happen in alternative text attributes.

To address this, navigate to the Format specified in the error message, and escape any variables that may contain problematic content such as titles or alternative text. For example, if you're outputting an image tag with:

<img src="${path}" alt="${alt}"/>

You can escape your alternative text attribute using the $_EscapeTool:

<img src="${path}" alt="${_EscapeTool.xml($alt)}"/>

This will ensure any problematic characters like & are escaped as &amp;.

The entity name must immediately follow the '&' in the entity reference. / The reference to entity "..." must end with the ';' delimiter.

Examples:

An error occurred: com.hannonhill.cascade.model.render.page.PageRenderException: Could not transform with Script format "path/to/format": Error on line ##: The entity name must immediately follow the '&' in the entity reference.
An error occurred: com.hannonhill.cascade.model.render.page.PageRenderException: Could not transform with Script format "path/to/format": Error on line ##: The reference to entity "..." must end with the ';' delimiter.

These usually indicate that an ampersand (&) character in a variable isn't being properly escaped in the Format listed in the error message.

To address this, navigate to the Format specified in the error message, and escape any variables that may contain non-XML-friendly content such as titles, descriptions, or links that may contain URL parameters.

For example, if you're outputting a title variable with:

<h1>$title</h1>

Escape the content using something like the $_EscapeTool:

<h1>${_EscapeTool.xml($title)}</h1>

This will ensure any invalid characters such as & are escaped as &amp;.

The requested asset does not exist: Format #import with path 'path/to/imported/format'

Example:

An error occurred: com.hannonhill.cascade.model.render.page.PageRenderException: Could not transform with Script format "path/to/format": com.hannonhill.cascade.exception.AssetNotFoundException: The requested asset does not exist: Format #import with path 'path/to/imported/format'

This indicates that the Format specified in the first half of the error message is importing another Format that doesn't exist at the path listed in the second half of the message.

Check the Format specified in the error message to ensure that the imported Format exists and that the path called out (ex. #import 'path/to/format') is correct.