String containerName = getSpecifiedContainerName(container);
if (container instanceof StyleFormatReference) {
StyleFormatReference styleFormatReference =
(StyleFormatReference) container;
FormatReference reference = styleFormatReference.getReference();
// Try and find the format instance.
Format format = pageContext.getFormat(reference.getStem(),
FormatNamespace.CONTAINER);
if (format != null) {
instance = (ContainerInstance) pageContext.getFormatInstance(
format, reference.getIndex());
}
} else if (containerName != null) {
final ContainerInstance currentContainer =