Kevin Flynn wrote:
> 
> In a docbook5-based document, when I run the following macro commands:
> 
>      <sequence>
>        <command name="insert" parameter="into 
> {http://docbook.org/ns/docbook}link"; />
>        <command name="putAttribute" parameter="[implicitElement] 
> {http://www.w3.org/1999/xlink}href"; />
>      </sequence>
> 
> and enter the attribute value:
> 
> http://www.google.com
> 
> I get  the following error:
> 
> "http://www.google.com"; invalid value for attribute "xlink:href"
> 

The error message is misleading but your macro indeed has a problem.

With DocBook 5,  a link element may have a linkend attribute or a 
xlink:href attribute but not both.

This command:

<command name="insert"
parameter="into {http://docbook.org/ns/docbook}link"; />

inserts a link having a linkend attribute. After that, there is no way 
to add a xlink:href attribute.

You need to replace it by:

<command name="insert"
parameter="into #template({http://docbook.org/ns/docbook}link,href)" />

[[[This element template is defined in docbook5.xxe:

   <elementTemplate name="href">
     <link xmlns="http://docbook.org/ns/docbook"; xlink:href="???"
           xmlns:xlink="http://www.w3.org/1999/xlink";></link>
   </elementTemplate>

]]]

This gives us:

<command name="db5.insertLink2">
   <macro undoable="true">
     <sequence>
        <command name="insert"
         parameter="into 
#template({http://docbook.org/ns/docbook}link,href)" />
        <command name="putAttribute"
         parameter="[implicitElement] {http://www.w3.org/1999/xlink}href"; />
     </sequence>
   </macro>
</command>

<binding>
   <keyPressed code="F3" />
   <command name="db5.insertLink2" />
</binding>

which works fine.




Reply via email to