nobili, philippe wrote:
> 
> We have developed a small add-on in XMLMind to allow editing XML instances 
> corresponding to a home defined XML schema. In this schema, the documentation 
> elements can
>  optionally be placeholder for strict XHTML body nodes. The whole thing is 
> converted to DocBook using XSLT.
> 
> Could you explain us how to allow the styled view defined for XHTML document 
> type to be used when editing the content of these documentation nodes ? We 
> think that this is used
> in the XML schema add-on in XMMind, but did not understand exactly how it 
> works...
> 

This is pretty simple to do.

--> Validation. Excerpts of wxs_config/wxs.xxe:
---
  <validate namespace="http://www.w3.org/1999/xhtml";>
    <dtd publicId="-//W3C//DTD XHTML 1.0 Strict//EN"
         systemId="xxe-config:xhtml/dtd/1.0/xhtml1-strict.dtd" />
  </validate>
---
More info. in
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/validate.html



--> Styled view. Excerpts of wxs_config/wxs.css:
---
@namespace "http://www.w3.org/1999/xhtml";;
@import url(xxe-config:xhtml/css/xhtml.css);

@namespace html "http://www.w3.org/1999/xhtml";;

xs|documentation > html|body {
    margin: 4px;
}
--



--> Menu and toolbar. Other excerpts of wxs_config/wxs.xxe:
---
<include location="xxe-config:xhtml/xhtml_support.incl" />

<elementTemplate name="htmldoc" selectable="false">
  <annotation xmlns="http://www.w3.org/2001/XMLSchema";>
    <documentation><body
      xmlns="http://www.w3.org/1999/xhtml";><p></p></body></documentation>
  </annotation>
</elementTemplate>

<command name="wxs.insertDocumentation">
  <macro>
    <sequence>
      <!-- Without this match, the toolbar button
           is enabled too often. -->
      <match context="$selectedElement" antiPattern="true"
             pattern="xs:annotation|xs:appinfo|xs:documentation|
                      *[child::xs:annotation]|
                      html:*" />
      <choice>
        <sequence>
          <!-- Try to insert in empty element. -->

          <test context="$selected"
                expression="count(child::node()) = 0" />
          <command name="insert"
            parameter="into
#template({http://www.w3.org/2001/XMLSchema}annotation,htmldoc)"/>
        </sequence>

        <sequence>
          <!-- Try to insert before first child element.
               Annotation elements are allowed as the first child
               element of almost all kinds of schema components. -->

          <set variable="selected"
               context="$selected" expression="child::xs:*[1]" />
          <command name="insert"
            parameter="before
#template({http://www.w3.org/2001/XMLSchema}annotation,htmldoc)"/>
        </sequence>
      </choice>
    </sequence>
  </macro>
</command>

<toolBar>
  <button toolTip="Insert documentation"
          icon="xxe-config:common/icons/documentation.png">
    <command name="wxs.insertDocumentation" />
  </button>
  <separator />
  <insert />
</toolBar>
---




 
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to