docs: public static void setUniqueIds(final BuildData buildData, final ITopicNode topicNode, final Node node, final Document doc,
              final Map<SpecTopic, Set<String>> usedIdAttributes) {
          // The root node needs to be handled slightly differently
          boolean isRootNode = doc.getDocumentElement() == node;
  
          final NamedNodeMap attributes = node.getAttributes();
          if (attributes != null) {
              final Node idAttribute;
              if (buildData.getDocBookVersion() == DocBookVersion.DOCBOOK_50) {
                  idAttribute = attributes.getNamedItem("xml:id");
              } else {
                  idAttribute = attributes.getNamedItem("id");
              }
              if (idAttribute != null) {
                  final String idAttributeValue = idAttribute.getNodeValue();
                  String fixedIdAttributeValue = idAttributeValue;
  
                  if (!isRootNode) {
                      // Set the duplicate id incase the topic has been included twice
                      if (topicNode.getDuplicateId() != null) {
                          fixedIdAttributeValue += "-" + topicNode.getDuplicateId();
                      }
  
                      // The same id may be used across multiple topics, so add the step/line number to make it unique
                      if (!DocBookBuildUtilities.isUniqueAttributeId(buildData, fixedIdAttributeValue, topicNode, usedIdAttributes)) {
                          fixedIdAttributeValue += "-" + topicNode.getStep();
                      }
                  }
  
                  setUniqueIdReferences(doc.getDocumentElement(), idAttributeValue, fixedIdAttributeValue);
  
                  idAttribute.setNodeValue(fixedIdAttributeValue);
              }
          }
  
          final NodeList elements = node.getChildNodes();
          for (int i = 0; i < elements.getLength(); ++i) {
              setUniqueIds(buildData, topicNode, elements.item(i), doc, usedIdAttributes);
          }
      }