Be able to sort DITA Simple List Items

Are you missing a feature? Request it's implementation here.
lief.erickson
Posts: 14

Be able to sort DITA Simple List Items

Fri Mar 13, 2015 6:14 am

Hello--

oXygen has to capability to sort ordered and unordered lists, but the <sl> / <sli> elements cannot be sorted. Can this functionality be added?

-Lief
alex_jitianu
Posts: 604

Re: Be able to sort DITA Simple List Items

Fri Mar 13, 2015 12:44 pm

Hello Lief,

I've added a feature request to offer the sort action for simple lists too. Until then, you could implement a sort author action based on an XSLT script, like this:

1. Create an Author action that uses the XSLTTransformOperation
2. Configuration details:
- when this XPath expression is true : ancestor-or-self::sl[1
- sourceLocation : ancestor-or-self::sl[1]
- targetLocation : ancestor-or-self::sl[1]
- invoke the operation : ro.sync.ecss.extensions.commons.operations.XSLTOperation
- script (you should change the xsl:sort from the script as needed):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="2.0">
   
    <xsl:template match="sl">
        <xsl:copy>
        <xsl:for-each select="sli">
            <xsl:sort select="text()"></xsl:sort>
           
            <xsl:copy-of select="."></xsl:copy-of>
        </xsl:for-each>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>


3. Add this action on the toolbar.

Best regards,
Alex
lief.erickson
Posts: 14

Re: Be able to sort DITA Simple List Items

Fri Mar 13, 2015 8:28 pm

Thanks for filing the feature request and, more immediately, the workaround, Alex. I've added an Author action as you've suggested, but when I select an <sl> element the action is not available. The action is grayed out on the toolbar (or not visible on the context menu). I've never created an Author action before. Can you confirm that I have configured the author action correctly?

Image

-Lief
alex_jitianu
Posts: 604

Re: Be able to sort DITA Simple List Items

Mon Mar 16, 2015 9:54 am

Hello Lief,

When you fully select an sl element the caret is positioned after it and the activation XPath doesn't work anymore. You can cover this situation with this activation XPath:

When this XPath expression is true:

Code: Select all

oxy:current-selected-element()[contains(@class," topic/sl ")] or ancestor-or-self::sl[1]


Best regards,
Alex
lief.erickson
Posts: 14

Re: Be able to sort DITA Simple List Items

Mon Mar 16, 2015 6:08 pm

That change did it. Thank you!
Radu
Posts: 5223

Re: Be able to sort DITA Simple List Items

Mon May 18, 2015 3:02 pm

Hi,

Just to update this thread, with Oxygen 17 you can now use the default sort operation to sort simple list items.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “Feature Request”

Who is online

Users browsing this forum: No registered users and 3 guests