Bonjour Hussein,

as usual, thanks a lot for your accurate and useful answer. It works
like a charm!

Please allow me to give back my 0.02€. I've modified the test to
consider other bullet types like this:

<xsl:when test="starts-with(., '*') or starts-with(., '#') or
starts-with(., '•') or starts-with(., 'o') or starts-with(., '')">

Note that the last starts-with test seems to cover the "graphical"
bullet types too (at least with the few ones I've tested).

Thanks again, and get ready for my next question! (coming soon ;-))

2011/11/22 Hussein Shafie <huss...@xmlmind.com>:
> On 11/21/2011 06:17 PM, Fabián Mandelbaum wrote:
>>
>> On our custom extension, we'd need to preprocess text pasted onto the
>> clipboard before "pasting after as" that text in the document.
>> Specifically, we have this in the 0docbook5.xxe file of our extension:
>>
>> <button toolTip="PasteItemizedList"
>> icon="icons/pasteAfterAsItemizedList.png">
>>       <command name="pasteAfterAs"
>>
>> parameter="#template({http://docbook.org/ns/docbook}itemizedlist,PAA.itemizedlist)"
>> />
>>     </button>
>>
>> and I'd like to remove the bullets left over in the pasted text on the
>> clipboard before executing the pasteAfterAs command when that button
>> is clicked.
>>
>> Is there an already built command I can use to get rid of the bullets
>> (string manipulation of the text pasted on the clipboard)
>
> No, there is no such facility. We'll try to add it in next release.
>
>
>
>> or should I
>> write one and insert it in the command chain somehow?
>>
>
> For now, a macro-command like this one should solve your problem:
>
> ---
> <command name="pasteAsList">
>  <macro>
>    <sequence>
>      <command name="formatTextAs"
>
> parameter="#template({http://docbook.org/ns/docbook}itemizedlist,PAA.itemizedlist)"
> />
>
>      <transform source="%_">
>        <xsl:stylesheet version="1.0"
>          xmlns:db="http://docbook.org/ns/docbook";
>          xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>          <xsl:template match="db:listitem/db:para/text()[1]">
>            <xsl:choose>
>              <xsl:when test="starts-with(., '*') or
>                              starts-with(., '#')">
>                <xsl:value-of select="substring(., 2)"/>
>              </xsl:when>
>              <xsl:otherwise><xsl:copy/></xsl:otherwise>
>            </xsl:choose>
>          </xsl:template>
>
>          <xsl:template match="@*|node()">
>            <xsl:copy>
>              <xsl:apply-templates select="@*|node()"/>
>            </xsl:copy>
>          </xsl:template>
>        </xsl:stylesheet>
>      </transform>
>
>      <command name="paste"
>               parameter="after[implicitElement] %_" />
>    </sequence>
>  </macro>
> </command>
>
> <binding>
>  <keyPressed code="F5" />
>  <command name="pasteAsList" />
> </binding>
> ---
>
>



-- 
Fabián Mandelbaum
IS Engineer
 
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to