Scott Starker wrote:
> 
> I did [1] and [3] (the match worked fine: [2]) and it did not work. 
> However, I deleted <pass> and running XXE (File | New | 
> Interlinearization) at the top toolbar I clicked on "words" and pressed 
> the F12 key. It worked! 

Sorry I didn't see the <pass> element!

"<pass><match/></pass>" does not make sense as <match> is already a test 
on its own.



> If this is so, there seems to be a command 
> missing between 'match Int:langData' and 'insert 
> {http://www.xmlmind.com/xmleditor/schema/Interlinearization}words' that 
> puts the elements together. Does this make sense?
> 

Yes. I don't know your schema therefore I cannot give the exact solution.

In general, a macro like the one you want to do looks like this:

[1]
selectNode ancestorOrSelf[implicitElement] list_of_acceptable_ancestors

[2]
insert after to_be_inserted

Therefore please remove the match which is not needed and replace it by 
the proper selectNode.

See http://www.xmlmind.com/xmleditor/_distrib/doc/commands/selectNode.html

Advanced example here:
http://www.xmlmind.com/xmleditor/_distrib/doc/commands/macro_examples.html



> ----- Original Message ----- From: "Hussein Shafie" <hussein at xmlmind.com>
> To: "Scott Starker" <Scott_Starker at sil.org>
> Cc: <xmleditor-support at xmlmind.com>
> Sent: Friday, October 20, 2006 1:38 AM
> Subject: Re: [XXE] adding elements using binding
> 
> 
>> Scott Starker wrote:
>>>
>>> I'm trying to do an xxe that one can entry in an interlinear text (the
>>> language text, the gloss text and the free translation). I have it all
>>> working except the part were one would press F12 (I would eventually 
>>> have
>>> the key be a SPACE | TAB keys though) where it would generates another
>>
>> Tab, Shift-Tab are ``reserved by the system''.
>>
>> Ctrl-Tab is bound to "insert a Tab character".
>>
>> Space is bound to "insert a space character".
>>
>> Ctrl-Space is bound to "insert a non breaking space character".
>>
>> I suggest using Shift-Space.
>>
>>> langData and gloss.
>>>
>>> I have:
>>>
>>> <cfg:binding>
>>> <cfg:keyPressed code="F12"/>
>>> <cfg:command name="newWords"/>
>>> </cfg:binding>
>>>
>>> <cfg:command name="newWords">
>>> <cfg:macro>
>>> <cfg:sequence>
>>> <cfg:command name="alert" parameter="before insert try 1"/>
>>> <cfg:pass>
>>> <cfg:match context="$implicitElement" pattern="Int:langData |
>>> Int:gloss"></cfg:match>
>>> </cfg:pass>
>>> <cfg:command name="alert" parameter="before insert try 2"/>
>>> <cfg:command name="insert" parameter="after[implicitElement]
>>> #template(Int:words,interlinearization_1_g_free)"/>
>>> </cfg:sequence>
>>> </cfg:macro>
>>> </cfg:command>
>>>
>>>
>>> <cfg:elementTemplate name="interlinearization_1_g_free">
>>> <Int:words>
>>> <Int:word>
>>>    <Int:langData lang="l"/>
>>> </Int:word>
>>> <Int:word>
>>>    <Int:gloss lang="l"/>
>>> </Int:word>
>>> </Int:words>
>>> </cfg:elementTemplate>
>>>
>>
>> [1] Make sure that you have properly declared the "Int" prefix in the
>> configuration files which contain the "newWords" command and the
>> "interlinearization_1_g_free" element template.
>>
>> [2] Are you 100% sure of the pattern of your match element? (I cannot
>> help you with that because I don't know your schema.)
>>
>> [3] The parameter of a command is a plain string where namespace
>> prefixes have no special significance. Therefore, please replace:
>> ---
>> <cfg:command name="insert" parameter="after[implicitElement]
>> #template(Int:words,interlinearization_1_g_free)"/>
>> ---
>> by:
>> ---
>> <cfg:command name="insert" parameter="after[implicitElement]
>> #template({namespace_associated_to_Int}words,interlinearization_1_g_free)"/> 
>>
>> ---
>>
>> This pitfall is documented here:
>> http://www.xmlmind.com/xmleditor/_distrib/doc/commands/commandref.html
>>

Reply via email to