<?xml version='1.0' encoding='ISO-8859-1'?>
<configuration 
  xmlns="http://www.xmlmind.com/xmleditor/schema/configuration"
  xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration">

<!-- =================================================================== -->
<!-- Works in an XHTML document. -->

<binding>
  <keyPressed code="F2" />
  <command name="addListItem" />
</binding>

<command name="addListItem">
  <macro undoable="true">
    <choice>
      <sequence>
        <command name="selectNode" 
                 parameter="ancestor[implicitElement] 
                            {http://www.w3.org/1999/xhtml}ul 
                            {http://www.w3.org/1999/xhtml}ol" />
        <command name="selectNode" parameter="child" />
        <command name="insertNode" parameter="sameElementAfter" />
      </sequence>

      <sequence>
        <choice>
          <sequence>
            <command name="selectNode" 
                     parameter="ancestorOrSelf[implicitElement] 
                                {http://www.w3.org/1999/xhtml}dt" />
            <!-- Assumes that a dt is followed by a dd. -->
            <command name="selectNode" parameter="nextSibling" />
          </sequence>
          <command name="selectNode" 
                   parameter="ancestorOrSelf[implicitElement] 
                              {http://www.w3.org/1999/xhtml}dd" />
        </choice>
        <command name="insert"
                 parameter="after {http://www.w3.org/1999/xhtml}dt" />
        <command name="insert"
                 parameter="after {http://www.w3.org/1999/xhtml}dd" />
        <command name="selectNode" parameter="previousSibling" />
      </sequence>
    </choice>
  </macro>
</command>

<!-- =================================================================== -->
<!-- Works in an XHTML document. -->

<binding>
  <keyPressed code="F3" />
  <command name="convertToLink" parameter="href ???" />
</binding>

<binding>
  <keyPressed code="F3" modifiers="shift" />
  <command name="convertToLink" parameter="name XXX" />
</binding>

<command name="convertToLink">
  <macro undoable="true" repeatable="true" label="Convert to &lt;a&gt;">
    <sequence>
      <command name="convert" parameter="{http://www.w3.org/1999/xhtml}a" />
      <command name="putAttribute" parameter="%0 %1" />
    </sequence>
  </macro>
</command>

<!-- =================================================================== -->
<!-- Works in a any document. -->

<binding>
  <keyPressed code="F4" />
  <command name="insertCommandOutput" />
</binding>

<command name="insertCommandOutput">
  <macro>
    <sequence>
      <command name="run" />
      <command name="insertString" parameter="%_" />
    </sequence>
  </macro>
</command>

<!-- =================================================================== -->
<!-- Works in a any document. -->

<binding>
  <keyPressed code="F5" modifiers="alt" />
  <command name="preview" />
</binding>

<command name="preview">
  <macro>
    <sequence>
      <pass>
        <match context="/*" pattern="html:html" 
               xmlns:html="http://www.w3.org/1999/xhtml" />
        <fail><command name="XXE.save" /></fail>
      </pass>
      <command name="start" parameter="helper(defaultViewer) '%D'" />
    </sequence>
  </macro>
</command>

<!-- =================================================================== -->
<!-- Works in a DocBook 4 document. -->

<binding>
  <keyPressed code="F6" />
  <command name="moveListItemDown" />
</binding>

<command name="moveListItemDown">
  <macro undoable="true" label="Move List Item Down">
    <sequence>
      <command name="selectNode" 
        parameter="ancestorOrSelf[implicitElement] listitem callout step" />
      <match context="$selected" pattern="*[position() &lt; last()]" />
      <set variable="anchor" context="$selected" 
           expression="./following-sibling::*[1]" />
      <command name="cut" />
      <set variable="selected" expression="$anchor" />
      <command name="paste" parameter="after" />
    </sequence>
  </macro>
</command>

<binding>
  <keyPressed code="F6" modifiers="shift" />
  <command name="moveListItemUp" />
</binding>

<command name="moveListItemUp">
  <macro undoable="true" label="Move List Item Up">
    <sequence>
      <command name="selectNode" 
        parameter="ancestorOrSelf[implicitElement] listitem callout step" />
      <match context="$selected" pattern="*[position() &gt; 1]" />
      <set variable="anchor" context="$selected" 
           expression="./preceding-sibling::*[1]" />
      <command name="cut" />
      <set variable="selected" expression="$anchor" />
      <command name="paste" parameter="before" />
    </sequence>
  </macro>
</command>

<!-- =================================================================== -->
<!-- Works in an XHTML document. -->

<binding>
  <appEvent name="drop" />
  <command name="dropURL" parameter="%{value}" />
</binding>

<command name="dropURL">
  <macro>
    <choice>
      <sequence>
        <match context="$clickedElement" pattern="html:a[@href]" 
               xmlns:html="http://www.w3.org/1999/xhtml" />
        <set variable="selected" expression="$clickedElement" />
        <get expression="relativize-uri('%0')" />
        <command name="putAttribute" parameter="href '%_'" />
        <command name="status" parameter="Changed href."/>
      </sequence>

      <command name="XXE.open" parameter="%0" />
    </choice>
  </macro>
</command>

<!-- =================================================================== -->
<!-- Works in an XHTML document. -->

<binding>
  <keyPressed code="F7" />
  <command name="insertFromOtherDoc" 
           parameter="into" />
</binding>

<property name="templateFile"
          url="true">VATrates.html</property>

<command name="insertFromOtherDoc">
  <macro>
    <sequence>
      <command name="prompt"
        parameter="Question 
                   'ID of the element to be inserted at caret position (e.g. germany_vat):'" />
      <set variable="elementId" expression="%_"
           plainString="true" />
      <get expression="serialize(document(system-property('templateFile'))//*[@id=$elementId])"/>
      <command name="paste" parameter="%0 %_" />
    </sequence>
  </macro>
</command>

<!-- =================================================================== -->
<!-- Works in a DocBook 5 document. -->

<binding>
  <keyPressed code="F8" />
  <command name="paraToFormalpara" />
</binding>

<command name="paraToFormalpara">
  <macro>
    <sequence>
      <command name="selectNode" 
               parameter="ancestorOrSelf[implicitElement] 
                          {http://docbook.org/ns/docbook}para" />

      <get expression="serialize($selectedElement)"/>

      <transform source="%_">
        <xsl:stylesheet version="1.0" 
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:db="http://docbook.org/ns/docbook">
          <xsl:template match="/db:para">
            <db:formalpara>
              <xsl:for-each select="@*">
                <xsl:copy/>
              </xsl:for-each>

              <db:title></db:title>
              <db:para>
                <xsl:apply-templates select="node()"/>
              </db:para>
            </db:formalpara>
          </xsl:template>

          <xsl:template match="@*|node()">
            <xsl:copy>
              <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
          </xsl:template>

        </xsl:stylesheet>
      </transform>
      <command name="paste" parameter="to %_"/>
    </sequence>
  </macro>
</command>

<!-- =================================================================== -->
<!-- Works in a DocBook 4 document. -->

<binding>
  <keyPressed code="F8" modifiers="shift" />
  <command name="paraToFormalpara" />
</binding>

<command name="paraToFormalpara">
  <macro>
    <sequence>
      <command name="selectNode" 
               parameter="ancestorOrSelf[implicitElement] para" />
      <get expression="serialize($selectedElement)"/>
      <transform source="%_">
        <xsl:stylesheet version="1.0" xmlns=""
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

          <xsl:template match="/para">
            <formalpara>
              <xsl:for-each select="@*">
                <xsl:copy/>
              </xsl:for-each>

              <title></title>
              <para>
                <xsl:apply-templates select="node()"/>
              </para>
            </formalpara>
          </xsl:template>

          <xsl:template match="@*|node()">
            <xsl:copy>
              <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
          </xsl:template>

        </xsl:stylesheet>
      </transform>
      <command name="paste" parameter="to %_"/>
    </sequence>
  </macro>
</command>

</configuration>
