[Framers] Read-write rules for graphics
Hello All Using FM11. I have been wrestling for a few days with read-write rules for graphics. When I save my (rather simple) structured FM file as XML, all is fine except for the images. All my images are imported by reference, and the anchored frames contain only one image each. My rules for the element are: element "image" { is fm graphic element; fm property import by reference or copy value is "ref"; writer facet default { export dpi is 96; specify size in in; } attribute "href" { /* is fm attribute; */ is fm property file; } attribute "position" { is fm property position; value "inline" is fm property value inline; value "break" is fm property value bottom; /* value "runin" is fm property value runin; */ } attribute "align" { is fm property alignment; value "left" is fm property value align left; value "right" is fm property value align right; value "center" is fm property value align center; value "current" is fm property value align center; } attribute "height" { is fm property height; is fm attribute; } attribute "width" { is fm property width; is fm attribute; } } There are a couple of issues: 1. The "href" attribute, which is defined in my EDD as arequired id, exports as an empty string. I need it to populate with the path to my referenced graphic. You will note that I have commented out one line of the rules, but it makes no difference. Do I have to specify the "href" value in FM, or should it pick up the filename automatically when exporting? 2. In the "position" attribute, the "runin" line results in an error when checking the rules document. Hence it too is commented out. However, the Developer Reference mentions "runin" as a valid value for the FM property, and the other values don't cause the error. What gives? 3. How do I get the XML to record the *actual* sizes of the referenced graphics? The sizes exported to the XML (in the height and width attributes) are bigger than in my FM document, so if I fiddle the "href" value and then reopen the doc in FM, they import in the larger size. Believe me, I have scoured the Structure Dev Ref and the Developer Guide and tried all kinds of permutations, but nothing works as I wish. Of course, having been retired for six years my memory of these things is somewhat hazy anyway... Thanks in advance. Roger ___ This message is from the Framers mailing list Send messages to framers@lists.frameusers.com Visit the list's homepage at http://www.frameusers.com Archives located at http://www.mail-archive.com/framers%40lists.frameusers.com/ Subscribe and unsubscribe at http://lists.frameusers.com/listinfo.cgi/framers-frameusers.com Send administrative questions to listad...@frameusers.com
Re: [Framers] Read-write rules for graphics
On 9/9/2019 11:15 AM, Roger Shuttleworth wrote: Using FM11. Roger, Have you tried a later version of FM? ... All my images are imported by reference, and the anchored frames contain only one image each. ... 1. The "href" attribute, which is defined in my EDD as arequired id, exports as an empty string. I need it to populate with the path to my referenced graphic. You will note that I have commented out one line of the rules, but it makes no difference. Do I have to specify the "href" value in FM, or should it pick up the filename automatically when exporting? I'll respond to your other questions after I've had time to do some relevant testing, but why do you want the href attribute stored in FM? And why do you want it to be a unique ID? How is it declared in the DTD? Pathnames contain characters (particularly slashes and possibly spaces) that are not permitted in ID attributes in XML. Furthermore, I don't know if your documents ever contain multiple copies of the same graphic file, but if you use the filename as an ID, you preclude that possibility. Structured cross-references do use ID attributes for cross-references, but cross-references for images typically refer to something like a container that includes a figure number rater than the anchored frame itself. FM should export the filename to the appropriate attribute regardless of any value stored in FM. The only reason I can think of for importing the filename would be to display it in the FM document as a cross-reference to the graphic element. Do you have such a requirement? --Lynne -- Lynne A. Price Text Structure Consulting, Inc. Specializing in structured FrameMaker consulting, application development, and training lpr...@txstruct.comhttp://www.txstruct.com voice/fax: (510) 583-1505 cell phone: (510) 421-2284 ___ This message is from the Framers mailing list Send messages to framers@lists.frameusers.com Visit the list's homepage at http://www.frameusers.com Archives located at http://www.mail-archive.com/framers%40lists.frameusers.com/ Subscribe and unsubscribe at http://lists.frameusers.com/listinfo.cgi/framers-frameusers.com Send administrative questions to listad...@frameusers.com
Re: [Framers] Read-write rules for graphics
Hello Roger, we use a setting where (almost) all elements are controlled by FrameMaker: element "Graphic" { is fm graphic element; } element "I.Graphic" { is fm graphic element; attribute "file" is fm property file; } This works very well, here an example for the XML output/input of a Graphic element: - I do not see an error in your definitions. But you are adding many definitions that may be redundant -- as you can see, "align", "height", "position" and "width" do not need a special treatment. Maybe you should start anew with the smallest possible, working setting -- just trying to find out, what FrameMaker does in the import/export and then adjusting it step by step. Best -- Tino H.Haida, Berlin Am 2019-09-09 20:15, schrieb Roger Shuttleworth: > Hello All > > Using FM11. I have been wrestling for a few days with read-write rules for > graphics. When I save my (rather simple) structured FM file as XML, all is > fine except for the images. All my images are imported by reference, and the > anchored frames contain only one image each. My rules for the element > are: > > element "image" { > is fm graphic element; > fm property import by reference or copy value is "ref"; > writer facet default { > export dpi is 96; > specify size in in; } > attribute "href" { > /* is fm attribute; */ > is fm property file; > } > attribute "position" { > is fm property position; > value "inline" is fm property value inline; > value "break" is fm property value bottom; > /* value "runin" is fm property value runin; */ > } > attribute "align" { > is fm property alignment; > value "left" is fm property value align left; > value "right" is fm property value align right; > value "center" is fm property value align center; > value "current" is fm property value align center; > } > attribute "height" { > is fm property height; > is fm attribute; > } > attribute "width" { > is fm property width; > is fm attribute; > } > } > > There are a couple of issues: > > 1. The "href" attribute, which is defined in my EDD as arequired id, > exports as an empty string. I need it to populate with the path to > my referenced graphic. You will note that I have commented out one > line of the rules, but it makes no difference. Do I have to specify > the "href" value in FM, or should it pick up the filename > automatically when exporting? > 2. In the "position" attribute, the "runin" line results in an error > when checking the rules document. Hence it too is commented out. > However, the Developer Reference mentions "runin" as a valid value > for the FM property, and the other values don't cause the error. > What gives? > 3. How do I get the XML to record the *actual* sizes of the referenced > graphics? The sizes exported to the XML (in the height and width > attributes) are bigger than in my FM document, so if I fiddle the > "href" value and then reopen the doc in FM, they import in the > larger size. > > Believe me, I have scoured the Structure Dev Ref and the Developer Guide and > tried all kinds of permutations, but nothing works as I wish. Of course, > having been retired for six years my memory of these things is somewhat hazy > anyway... > > Thanks in advance. > > Roger > > ___ > > This message is from the Framers mailing list > > Send messages to framers@lists.frameusers.com > Visit the list's homepage at http://www.frameusers.com > Archives located at > http://www.mail-archive.com/framers%40lists.frameusers.com/ > Subscribe and unsubscribe at > http://lists.frameusers.com/listinfo.cgi/framers-frameusers.com > Send administrative questions to listad...@frameusers.com ___ This message is from the Framers mailing list Send messages to framers@lists.frameusers.com Visit the list's homepage at http://www.frameusers.com Archives located at http://www.mail-archive.com/framers%40lists.frameusers.com/ Subscribe and unsubscribe at http://lists.frameusers.com/listinfo.cgi/framers-frameusers.com Send administrative questions to listad...@frameusers.com
Re: [Framers] Read-write rules for graphics
Hello Lynne and Tino Thank you for your replies. My apologies for not getting back to you sooner. I have been trying some other approaches without much success. To answer Lynne's first question: No, FM11 is my personal version. The investigation I am doing is for a charity, so there is little hope of any cash - and even if there were, FM11 up till now has met my needs, and I don't really want to learn a whole new version. Another apology: I misspoke regarding the "href" attribute, which was in fact a required *string* and not an id. According to Tino's suggestion, I have tried using a very simple rule: element "image" { is fm graphic element; attribute "file" is fm property file; } I have a very simple document consisting of a title and a single paragraph containing some text and an anchored frame at insertion point, with one referenced graphic. I changed the "href" attribute to Optional in the EDD, and added no attribute values at all. I get the following XML: graphicname="1778433278" />This is some text I have no idea why the XML contains a "graphicname" attribute, since this does not exist in the FM document or the rules. If I change the anchored frame to Run into Paragraph, aligned Left, the XML is identical. Changing the EDD so that the InitialObjectFormat for is either an anchored frame or an imported graphic file makes no difference: same XML. Opening the XML in FM not surprisingly generates an error message in the console: Error importing graphic for element (image). Adding a subrule, attribute "align" is fm property alignment; makes no difference. Even more strange: If I manually add an href value and then export XML, the href value is exported, e.g.: graphicname="2109691528" /> But when I open this XML in FM, the element is dropped altogether and the console has a message, "Error importing graphic for element (image)." Maybe I'm missing something very obvious... Roger P.S. I don't want to take up your time; I'm resigned to fiddling and researching until I conquer this! On 09/09/2019 20:50, Lynne A. Price wrote: On 9/9/2019 11:15 AM, Roger Shuttleworth wrote: Using FM11. Roger, Have you tried a later version of FM? ... All my images are imported by reference, and the anchored frames contain only one image each. ... 1. The "href" attribute, which is defined in my EDD as arequired id, exports as an empty string. I need it to populate with the path to my referenced graphic. You will note that I have commented out one line of the rules, but it makes no difference. Do I have to specify the "href" value in FM, or should it pick up the filename automatically when exporting? I'll respond to your other questions after I've had time to do some relevant testing, but why do you want the href attribute stored in FM? And why do you want it to be a unique ID? How is it declared in the DTD? Pathnames contain characters (particularly slashes and possibly spaces) that are not permitted in ID attributes in XML. Furthermore, I don't know if your documents ever contain multiple copies of the same graphic file, but if you use the filename as an ID, you preclude that possibility. Structured cross-references do use ID attributes for cross-references, but cross-references for images typically refer to something like a container that includes a figure number rater than the anchored frame itself. FM should export the filename to the appropriate attribute regardless of any value stored in FM. The only reason I can think of for importing the filename would be to display it in the FM document as a cross-reference to the graphic element. Do you have such a requirement? --Lynne ___ This message is from the Framers mailing list Send messages to framers@lists.frameusers.com Visit the list's homepage at http://www.frameusers.com Archives located at http://www.mail-archive.com/framers%40lists.frameusers.com/ Subscribe and unsubscribe at http://lists.frameusers.com/listinfo.cgi/framers-frameusers.com Send administrative questions to listad...@frameusers.com