Skip to main content
1-Visitor
November 13, 2010
Solved

Relative path when inserting an image in Arbortext Editor

  • November 13, 2010
  • 1 reply
  • 3296 views

Suppose my xml document is at c:\temp\xml

If I insert a graphic which is stored at the same level of my XML document, the result is :

<inlinegraphic fileref="graphic6.png"/>

If the graphic is in an image directory at the same level, it becomes :

<inlinegraphic fileref="images/graphic6.png"/>

Now, if I want to reference an image that is one level down in my tree structure (temp/shared), A/E switch to absolute path and the result is ;

<inlinegraphic fileref="c:\temp\shared\graphic6.png"/>

So my question : is is possible to hava a relative path (../shared/graphic6.png) instead of an absolute.

Any idea is welcome, Pierat

    Best answer by

    A little ACL can help you here. I use the insert_tag_after callback to modify the attribute value for the system path when authors insert an image element.

    doc_add_callback(0,'insert_tag_after','img_pathfix')

    function img_pathfix (doc,tagname,op)
    {
    if(op ==1)
    {
    if(tagname == 'image')
    {
    #response("found an image")
    o = oid_attr(oid_caret(),'system-path')
    oid_modify_attr(oid_caret(),'system-path',universal_file_name(o))
    }
    }
    }

    I use this function to change mapped network drive paths to UNC paths, but after capturing the attribute's value with o=oid_attr(oid,attname), you should be able to modify that value any way you feel necessary and use the oid_modify_attr(oid,attname,val) to "fix" the value.

    There is also an insert_tag callback, but it triggers before the markup is inserted, so it's ineffective for modifying an attribute since the element hasn't been inserted yet.

    Hope this helps...

    -Jason A. Buss

    1 reply

    Answer
    November 18, 2010

    A little ACL can help you here. I use the insert_tag_after callback to modify the attribute value for the system path when authors insert an image element.

    doc_add_callback(0,'insert_tag_after','img_pathfix')

    function img_pathfix (doc,tagname,op)
    {
    if(op ==1)
    {
    if(tagname == 'image')
    {
    #response("found an image")
    o = oid_attr(oid_caret(),'system-path')
    oid_modify_attr(oid_caret(),'system-path',universal_file_name(o))
    }
    }
    }

    I use this function to change mapped network drive paths to UNC paths, but after capturing the attribute's value with o=oid_attr(oid,attname), you should be able to modify that value any way you feel necessary and use the oid_modify_attr(oid,attname,val) to "fix" the value.

    There is also an insert_tag callback, but it triggers before the markup is inserted, so it's ineffective for modifying an attribute since the element hasn't been inserted yet.

    Hope this helps...

    -Jason A. Buss