Skip to main content
4everJang
Legend
April 6, 2021
Question

Making FM use @href instead of @entity when writing to XML

  • April 6, 2021
  • 2 replies
  • 367 views

I think FrameMaker can use @href for referenced images when writing a structured file to XML, but I cannot find the method to force FM to do so. It keeps writing <!ENTITY> definitions and referencing them instead. This causes unnecessary complications in post-processing the XML to DITA.

 

It might be trivial, but I have no time working my way through all the specs in the Structured App Guide and Reference. If someone can tell me what to add to the read-write rules (or the DTD, or the EDD, or wherever) that would be really helpful.

 

4everJang

This topic has been closed for replies.

2 replies

4everJang
4everJangAuthor
Legend
May 17, 2021

I finally found out how to suppress the <ENTITY> statements when exporting to XML. I created the DTD for the exported XML by saving the EDD as DTD. That process included the@entity on images, which kicks the <ENTITY> output mechanism into action, no matter which read-write rules you have set up. Once the @11272877 was removed from the DTD, those annoying statements were gone and the read-write rules (in which I map the fm file property to an @href) took over.

 

I would have expected the read-write rules to take precedence over some automatic fall-back entity mechanism. That would have saved me a lot of trial and error time.

4everJang
4everJangAuthor
Legend
April 8, 2021

Replying my own question, as nobody else seems to have a solution.

1. In XSLT I can dereference the entity declaration, but that leads to an absolute path, which is not always what I want to have, especially if the graphic files are in a subdirectory of the folder in which the FM file is located.

2. I decided to add an @href to each image and populate it using an ExtendScript - this files the file property of the graphic and writes it into the attribute. This allows the post-processing to simply ignore the @11272877 and use the @href instead. 

Legend
April 9, 2021

Hi Jang,

 

My XML export does this. It has been forever since I set up the structured application, but I looked in my read/write rules and I have this for my image element:

 

attribute "href" {
  is fm attribute "href";
  is fm property file;
}

 

...and I get elements in the XML like this:

 

<image height="2.264in" width="3.216in" align="center" href="../../../common/images/sscentral/ssc_ngui_burst_twoway_setup_1.png"...

 

I'm using XML schema. There is nothing special in the schema about the href attribute.

 

Maybe there is some other magic going on that I have forgotten about. But maybe this will help some.

 

Russ

 

 

4everJang
4everJangAuthor
Legend
April 9, 2021

Hi Russ,

I will have to check my read-write rules. Strange that this is not standard behaviour even without rules being defined.

Kind regards

Jang