Create XInclude from Selection

Are you missing a feature? Request it's implementation here.
Posts: 69

Create XInclude from Selection

Thu Mar 26, 2015 5:50 pm

Is there core product support for a feature where the user, in Author, selects an element, say a docbook chapter, and copies the selected content to a file and replaces the selection with an XInclude pointing to the newly created chapter fragment file? I would expect to find a feature like this under the refactor menu, but it doesn't seem to be there in 16.1 build 2015012213. If not it would be a great core product feature.
Posts: 418

Re: Create XInclude from Selection

Thu Mar 26, 2015 6:10 pm


Unfortunately, a refactoring action similar to your request is not yet available in oXygen, even in the latest version.

However, we already have an open improvement request in this direction, logged on our internal issue/improvement tracking system, regarding the possibility to create a document or an xref/conref/xinclude.
So this will be analyzed by the development team and, if found viable, will be implemented in a future version of oXygen XML.
I have just added your comments to the improvement request.

Thank you and let us know whenever you need any assistance or information.

Kind Regards,
Costin Sandoi
oXygen XML Editor and Author Support
Posts: 228
Location: Hamburg/Germany

Re: Create XInclude from Selection

Thu Mar 26, 2015 7:10 pm

It's quite easy to implement a custom author action using XsltOperation.

The limits of my implementation:
- The author can't enter the filename. It is rather generated from the title.
- Thus it is limited to elements with a title element.
- It doesn't use the selectionbut takes the first suitable ancestor element from the cursor position.


Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
   <xsl:template match="*[title]">
      <xsl:message select="base-uri(.)"/>
      <xsl:variable name="filename" as="xs:string"
         select="concat(replace(normalize-space(title), '[^a-zA-Z0-9\-_]+', ''), '.dita')"/>
      <xsl:result-document href="{resolve-uri($filename, base-uri())}">
         <xsl:sequence select="."/>
      <xsl:element name="include" namespace="">
         <xsl:attribute name="href" select="$filename"/>

condition: exists(ancestor-or-self::*[title][1] except /*)
source- and targetLocation: ancestor-or-self::*[title][1]
action: replace

Note that this will overwrite any existing file with the same name without warning...

BTW: For my own document type I implemented an author action to export all top-level topics/chapters/appendixes... in seperate files and import them with xInclude. It is very handy when a file gets too big.



Return to “Feature Request”

Who is online

Users browsing this forum: No registered users and 2 guests