/* wrap the xref up in a listitem */
if (sequenceID.optional)
{
if (internal)
{
final TranslatedTopicDataV1 relatedTranslatedTopicData = translatedTopicData.getLatestRelatedTranslationDataByTopicID(relatedTopic.getId());
if (relatedTranslatedTopicData != null)
{
final String url = getURLToInternalTranslatedTopic(relatedTranslatedTopicData.getTranslatedTopic().getId(), relatedTranslatedTopicData.getTranslationLocale());
/* Get the related translated data object and the title from the XML */
final String relatedTitle = DocBookUtilities.findTitle(relatedTranslatedTopicData.getTranslatedXml());
list.add(DocbookUtils.buildEmphasisPrefixedULink(xmlDocument, XMLPreProcessor.OPTIONAL_LIST_PREFIX, url, relatedTitle));
}
else
{
final String url = getURLToInternalTopic(relatedTopic.getId());
final String relatedTopicTitle = "[" + relatedTopic.getLocale() + "] " + relatedTopic.getTitle() + "*";
list.add(DocbookUtils.buildEmphasisPrefixedULink(xmlDocument, XMLPreProcessor.OPTIONAL_LIST_PREFIX, url, relatedTopicTitle));
/* Create an error note that is added at the bottom of the topic */
}
}
else
{
if (usedFixedUrls)
{
final PropertyTagV1 propTag = relatedTopic.getProperty(CommonConstants.FIXED_URL_PROP_TAG_ID);
if (propTag != null)
{
list.add(DocbookUtils.buildEmphasisPrefixedXRef(xmlDocument, XMLPreProcessor.OPTIONAL_LIST_PREFIX, propTag.getValue()));
}
else
{
list.add(DocbookUtils.buildEmphasisPrefixedXRef(xmlDocument, XMLPreProcessor.OPTIONAL_LIST_PREFIX, relatedTopic.getXRefID()));
}
}
else
{
list.add(DocbookUtils.buildEmphasisPrefixedXRef(xmlDocument, XMLPreProcessor.OPTIONAL_LIST_PREFIX, relatedTopic.getXRefID()));
}
}
}
else
{
if (internal)
{
final TranslatedTopicDataV1 relatedTranslatedTopicData = translatedTopicData.getLatestRelatedTranslationDataByTopicID(relatedTopic.getId());
if (relatedTranslatedTopicData != null)
{
final String url = getURLToInternalTranslatedTopic(relatedTranslatedTopicData.getTranslatedTopic().getId(), relatedTranslatedTopicData.getTranslationLocale());
/* Get the related translated data object and the title from the XML */
final String relatedTitle = DocBookUtilities.findTitle(relatedTranslatedTopicData.getTranslatedXml());
list.add(DocbookUtils.buildULink(xmlDocument, url, relatedTitle));
}
else
{