Andreas Kemkes wrote:
> I'm trying to replicate some of the bindings from
> xhtml.xxe and use them for my own document type, but
> I'm only partially successful.
> 
> Certain elements in my document are containers for
> xhtml content:
> 
> <xs:complexType name="text.type" mixed="true">
>   <xs:complexContent>
>     <xs:extension base="xhtml:Flow">
>       <xs:attributeGroup ref="xhtml:attrs"/>
>     </xs:extension>
>   </xs:complexContent>
> </xs:complexType>
> 
> I was able to implement the "ENTER" binding behavior
> and it works as expected after prefixing the p element
> with the xhtml namespace in curly braces, but I had no
> such luck with the "DELETE" and "BACK_SPACE" macro.
> 
> <macro trace="true">
>   <choice>
>     <sequence>
>       <test 
>         expression="$dot/ancestor::xhtml:p and
> not($selected) and not($mark)" />
>       <command
> name="deleteSelectionOrJoinOrDeleteChar"
> parameter="%0" />
>     </sequence>
>     <command name="deleteSelectionOrDeleteChar"
> parameter="%0" />
>   </choice>
> </macro>
> 
> The test fails.
> 
> ----------
> -->try.delete:choice: checking...
> -->try.delete:sequence: checking...
> -->try.delete:test: checking...
> <--try.delete:test: CANNOT EXECUTE
> <--try.delete:sequence: CANNOT EXECUTE
> -->try.delete:command: checking...
>    deleteSelectionOrDeleteChar "backwards"
> <--try.delete:command: can execute
> <--try.delete:choice: can execute
> ----------
> ==========
> -->try.delete:choice: executing...
> -->try.delete:command: executing...
>    deleteSelectionOrDeleteChar "backwards"
> ----------
> 
> How do I specify the test, so that it passes when the
> cursor is at .../xhtml:p/#text?  Couls it be a
> namespace related issue?
> 
> Likewise, the macros appendSame, prependSame,
> appendListItem, prependListItem and the toolbar
> buttons for adding p, li, ul, ol, and dl only work
> partially (i.e., differently than in an xhtml document
> - only inserting the top-most element) or not at all
> (e.g., appendListItem - may be due to an issue with
> the match).
> <macro trace="true" undoable="true" label="Add li">
>   <sequence>
>     <command name="selectNode" 
>       parameter="ancestorOrSelf[implicitElement]
> {http://www.w3.org/1999/xhtml}li"; />
>     <match context="$selected" pattern="xhtml:li" />
>     <command name="insertNode"
> parameter="sameElementAfter" />
>   </sequence>
> </macro>
> 
> -->try.appendListItem:sequence: executing...
> -->try.appendListItem:command: executing...
>    selectNode "ancestorOrSelf[implicitElement]
> {http://www.w3.org/1999/xhtml}li";
> 
> <--try.appendListItem:command: executed
> -->try.appendListItem:match: checking...
> <--try.appendListItem:match: CANNOT EXECUTE
> <--try.appendListItem:sequence: executed
> 
> Am I attempting something that is not supported?
> 
> If yes, what would be my best alternatives?
> 
> If no, how can I get more feedback from the system to
> help my analyze the issue further?
> 
> Is the command com.xmlmind.xmleditapp.xhtml.AddBlock
> functioning properly in my container (see above)?

You'll find in XMLeditor_install_dir/addon/config/schema/
ns_xhtml.incl, which is a *working* configuration for XHTML/namespace
aware. (You can include it as is if you want.)

This configuration is used to document W3C XML Schemas in XHTML (that
is, a mix of XSD and XHTML!) and for XHTML/RELAX NG.

--> I think that all your problems comes from the fact that you have not
declared the "xhtml" prefix in the XXE configuration file (not in the
schema or instance, in XXE *configuration* *file*).


-------------------------------------------------------------------------
Summary:
--------

* in <command name="XXX" parameter="YYY" />, parameter, which is a plain
string does not know anything about namespace prefixes. That's why you
see things like "{http://www.w3.org/1999/xhtml}li";.

* in <test>, <get>, <set>, <match> constructs, which are XPath-based,
using *declared* namespace prefixes is mandatory. And remember that
XPath has no concept of default namespace (e.g.
xmlns="http://www.foo.com/ns";).

* In XXE, some commands do their work based on local names (i.e. they
don't care about namespaces). For example, the table editing command:
com.xmlmind.xmleditapp.xhtml.table.HTMLTableEdit
-------------------------------------------------------------------------




> I also noticed that when the document starts up and
> whenever I click into the document, the appendListItem
> macro is executed.  This is true for the xhtml
> configuration as well.  I couldn't find anything in
> the configuration file that would explain it.  Is this
> implicit?  And why is it necessary?

You have in the XHTML toolbar a button which allows to add an item to a
list. This button uses macro appendListItem.

XXE ``quickly tests'' *all* commands (including macros having
trace="true"), each time the editing context changes. This, of course,
to enable/disable (i.e. gray out) the bound menu items, tool bar
buttons, etc.


Reply via email to