Awesome.  Thanks so much!

Hussein Shafie wrote:
> On 10/21/2010 07:25 PM, David Priest wrote:
>> I could spend the day reading docs and figuring out how to do this, but
>> I'm going to be lazy and ask here:
>>
>> Hussein, could you paste a snippet that places a button on the toolbar
>> that generates an xml:id for the selected element?  Most of the time I
>> manually name the bits and pieces I need to reference elsewhere, but at
>> the moment I'm cobbling together random paragraphs and really have no
>> need for sensible-to-humans IDs.
>>
>> I could swear that XXE used to have this functionality.  At the moment,
>> I'm thinking I should fiddle with Mercurial to have it run a
>> generate-id() transformation on check-in.  It certainly wouldn't harm my
>> documents if every. single. element. were to have an ID.
>
> Basically you need to invoke:
> ---
> <command name="addAttribute"
>           parameter="[implicitElement] [id] xml:id" />
> ---
>
> See http://www.xmlmind.com/xmleditor/_distrib/doc/commands/addAttribute.html
>
> However here's something more comfortable to use:
> ---
>    <binding>
>      <keyPressed code="F4" />
>      <command name="addId" />
>    </binding>
>
>    <command name="addId">
>      <macro>
>        <choice>
>          <sequence>
>            <command name="addAttribute"
>                     parameter="[implicitElement] [id] xml:id" />
>            <command name="selectNode"
>                     parameter="self[implicitElement]" />
>
>            <get context="$selectedElement" expression="@xml:id" />
>            <command name="status" parameter='xml:id="%_"' />
>          </sequence>
>
>          <sequence>
>            <get context="$implicitElement/@xml:id" expression="." />
>            <command name="status"
>              parameter='Already has xml:id="%_". Will not change it.' />
>          </sequence>
>        </choice>
>      </macro>
>    </command>
> ---
>
> Copy attached customize.xxe to one of the two addon/ subdirectories
> scanned by XXE during its startup and you are done.
>
> If you want a toolbar button rather than keyboard shortcut F4, then
> you'll have to tell me which stock configuration you want to customize.
> Is it DocBook 5?
>
>
> ---
> PS: XXE can automatically add an ID to newly inserted element. You need
> to customize your configuration to do that.
>
> ---
> <newElementContent generateIds="true" />
> ---
>
> See
> http://www.xmlmind.com/xmleditor/_distrib/doc/configure/newElementContent.html
>
>
 
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to