public static void SetupIdAndLineage(XmlElement parentPageDiv, XmlElement childPageDiv)
{
//NB: this works even if the parent and child are the same, which is the case when making a new book
//but not when we're adding an individual template page. (Later: Huh?)
childPageDiv.SetAttribute("id", Guid.NewGuid().ToString());
if (parentPageDiv != null) //until we get the xmatter also coming in, xmatter pages will have no parentDiv available
{
string parentId = parentPageDiv.GetAttribute("id");
string parentLineage = parentPageDiv.GetOptionalStringAttribute("data-pagelineage", string.Empty);
childPageDiv.SetAttribute("data-pagelineage", (parentLineage + ";" + parentId).Trim(new char[] {';'}));
}
}