Create XInclude from Selection
Are you missing a feature? Request its implementation here.
-
- Posts: 72
- Joined: Thu Mar 26, 2015 4:57 pm
Create XInclude from Selection
Post by steve.cuzner »
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: 846
- Joined: Mon Dec 05, 2011 6:04 pm
Re: Create XInclude from Selection
Hello,
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
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
Costin Sandoi
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Re: Create XInclude from Selection
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.
Script:
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.
Regards,
Patrik
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.
Script:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xs">
<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:result-document>
<xsl:element name="include" namespace="http://www.w3.org/2001/XInclude">
<xsl:attribute name="href" select="$filename"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
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.
Regards,
Patrik
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