Deleting everything except cross-reference structure from a book
Posted: Wed Nov 03, 2021 6:31 pm
Hi everyone,
I have a large book with a lot of content and many cross-references. To submit a testcase to Syncro Soft related to cross-reference behavior, I needed a way to remove the content but keep the cross-references.
One way to do this is to use Oxygen's built in Elements > Delete element refactoring operation, and use this for the element pattern:
This expression works as follows:
This greatly reduced the size of my cross-reference testcase.
The element pattern above does not keep empty <fig> or <table> elements around to satisfy non-topic cross-references, but you can also keep those elements as needed by adding them to the [not(self::*)] filter:
I have a large book with a lot of content and many cross-references. To submit a testcase to Syncro Soft related to cross-reference behavior, I needed a way to remove the content but keep the cross-references.
One way to do this is to use Oxygen's built in Elements > Delete element refactoring operation, and use this for the element pattern:
Code: Select all
*[not(descendant-or-self::xref or descendant-or-self::link)][not(self::topic or self::entry or self::colspec)]
- It deletes all elements except those that have an <xref> or <link> somewhere in their hierarchy.
- It leaves empty <topic> elements to avoid broken cross-reference targets.
- It leaves text surrounding the <xref> or <link> elements in place, but you can then obfuscate that by running Help > Support Tools > Randomize XML text content.
This greatly reduced the size of my cross-reference testcase.
The element pattern above does not keep empty <fig> or <table> elements around to satisfy non-topic cross-references, but you can also keep those elements as needed by adding them to the [not(self::*)] filter:
Code: Select all
*[not(descendant-or-self::xref or descendant-or-self::link)][not(self::topic or self::entry or self::colspec or self::fig or self::table)]