Running a refactoring operation only on the root map of a map hierarchy
Are you missing a feature? Request its implementation here.
-
- Posts: 918
- Joined: Thu May 02, 2019 2:32 pm
Running a refactoring operation only on the root map of a map hierarchy
Post by chrispitude »
I am working on a refactoring operation that processes an entire map at once, including all submap and topic files.
The transformation must consider information about the entire map hierarchy. Thus, the stylesheet runs in two stages like this:
Pass 1 is read-only pass that collections information about the entire map hierarchy. Pass 2 is a write pass that uses the pass 1 data to update the map/submap/topic files on disk.
Both passes take responsibility for recursing into all submap and topic documents using document(). Pass 2 takes responsibility for modifying submap/topic files using result-document(). So, the transformation should apply only to the root map file and not to any submap files.
Our users are accustomed to running refactoring operations on the DITA map hierarchy scope, either implicitly by invoking the operation from the DITA Maps Manager, or explicitly by invoking the operation from the menus then selecting the Current DITA map hierarchy scope. It is practically impossible to expect 100+ writers to unlearn this for one particular refactoring operation.
My question is, how can a stylesheet apply to (or at least identify) only the root map when invoked in a current DITA map hierarchy scope?
Perhaps one way could be for Oxygen to pass an additional XSLT parameter in that, if defined, specifies the root map of a map hierarchy:
Then the refactoring operation could work as follows:
The transformation must consider information about the entire map hierarchy. Thus, the stylesheet runs in two stages like this:
Code: Select all
<!-- this should match ONLY the root map of the entire map hierarchy -->
<xsl:variable name="root-map" select="/"/>
<!-- collect some information about the entire map/submap/topic hierarchy -->
<xsl:variable name="collected-data">
<xsl:apply-templates select="$root-map/*" mode="pass1"/>
</xsl:variable>
<!-- modify all the map/submap/topic files using the pass 1 data -->
<xsl:template match="$root-map/*">
<xsl:apply-templates select="." mode="pass2"/> <!-- uses $collected-data to make changes -->
</xsl:template>
Both passes take responsibility for recursing into all submap and topic documents using document(). Pass 2 takes responsibility for modifying submap/topic files using result-document(). So, the transformation should apply only to the root map file and not to any submap files.
Our users are accustomed to running refactoring operations on the DITA map hierarchy scope, either implicitly by invoking the operation from the DITA Maps Manager, or explicitly by invoking the operation from the menus then selecting the Current DITA map hierarchy scope. It is practically impossible to expect 100+ writers to unlearn this for one particular refactoring operation.
My question is, how can a stylesheet apply to (or at least identify) only the root map when invoked in a current DITA map hierarchy scope?
Perhaps one way could be for Oxygen to pass an additional XSLT parameter in that, if defined, specifies the root map of a map hierarchy:
Code: Select all
<xsl:param name="oxy-root-map-uri" as="xs:anyURI?"/>
- If $oxy-root-map-uri is defined, the stylesheet applies only to the document matching that URI.
- If $oxy-root-map-uri is not defined, the stylesheet applies to any .ditamap file (such as if maps are multi-selected in the Project view).
Re: Running a refactoring operation only on the root map of a map hierarchy
Hi Chris,
We have this static Java method in the Oxygen code "ro.sync.ecss.dita.DITAAccess.getRootMapURL()" which returns the root map in URL form. We consider the root map to be the DITA Map referenced in the "Context" combo box from the DITA Maps Manager view. So maybe you could try to call this public static method directly from the XSLT stylesheet similarly with how you worked with "DITAXSLTExtensionFunctionUtil".
Regards,
Radu
We have this static Java method in the Oxygen code "ro.sync.ecss.dita.DITAAccess.getRootMapURL()" which returns the root map in URL form. We consider the root map to be the DITA Map referenced in the "Context" combo box from the DITA Maps Manager view. So maybe you could try to call this public static method directly from the XSLT stylesheet similarly with how you worked with "DITAXSLTExtensionFunctionUtil".
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service