DITA and XMetaL Discussion
XMetaL Community Forum › DITA and XMetaL Discussion › Changing default height and width for the image element (reference topics)
-
kmartin7 February 10, 2009 at 9:40 pm
Changing default height and width for the image element (reference topics)
February 10, 2009 at 9:40 pmParticipants 3Replies 4Last Activity 14 years, 1 month agoWhat file(s) do we need to modify to set a default height and width for images used within a fig element. These are specific to the reference topic. We are using XMetaL 5.5.
Derek Read February 11, 2009 at 12:30 am
Reply to: Changing default height and width for the image element (reference topics)
February 11, 2009 at 12:30 amI should first warn that making these types of changes to the DITA functionality is not officially supported at this time and that it is really a closed system. What that really means is that if you change something and can't get it working the way you like or it breaks another feature the only thing you can really do is back out of that change and restore the out of box functionality. We have two features here that sometimes work against each other, one is the standard method of making CTM file changes that apply for any DTD or Schema and the other is a feature sometimes referred to as “Smart Insert” which only affects DITA functionality and is implemented via a series of scripts. In some cases “Smart Insert” may trump the CTM settings or vice versa. We are looking at what it will take long term to make these two things play nicer together for people such as yourself.
That having been said, you might be able to get what you want. If you are saying you wish to hard code the width and height attributes for Reference type topics then you can try modifying the following file:
C:Program FilesXMetaL 5.5AuthorDITAXACsreferencereference_ditabase.ctmThe section that needs to be modified is the following one:
[code]
fig
]]>
[/code]You can modify the content inside the CDATA section to contain any valid default content you like, including hard coded attribute values. If the content you put in there would cause the document to be invalid then the default element is inserted. There is some leniency here though, as you can leave out mandatory child nodes if you like. If you need detailed information on how CTM files work that is documented in the XMetaL Developer Customization Guide.
kmartin7 February 11, 2009 at 1:04 pm
Reply to: Changing default height and width for the image element (reference topics)
February 11, 2009 at 1:04 pmAs a related note, we were wondering why the interface ignores the height and width attributes of the image tag. We need this done because SVGs are too small to read.
Thank you.
Derek Read February 11, 2009 at 6:29 pm
Reply to: Changing default height and width for the image element (reference topics)
February 11, 2009 at 6:29 pmSVG is a special case. XMetaL does not currently support SVG natively. Instead for releases up to and including 5.5 we embed a copy of the Internet Explorer “WebBrowser Control” and let it deal with the SVG rendering. If you have an SVG viewer plug-in installed for IE (such as Adobe SVG viewer) then you should see SVG files.
However, as you have noticed, this feature has not been fully implemented. The script that tells IE how big to draw itself first loads the SVG document into MSXML to find the width and height attributes there. This in itself has some limits as MSXML cannot load all SVG files, particularly if they reference the SVG DTD or Schema. Code to get the width and height directly from the
element's attributes was simply not implemented. Someone familiar with creating customizations for XMetaL Author could modify this as the functionality that controls it is in this file: “C:Program FilesXMetaL 5.1AuthorDITAXACssharedobjectjsobject_op.js”
If I get some time at some point I'll see what it might take to get this working.
kmartin7 February 12, 2009 at 1:25 pm
Reply to: Changing default height and width for the image element (reference topics)
February 12, 2009 at 1:25 pmHi Derek,
We appreciate your response to this matter. I attempted to make changes to the *.js file in the following manner because our height and width attributes in the SVG node are always 100%, so I am trying to parse out the last two segments of the viewBox attribute in the root node. Here is my code so far (it does NOT work):
else {
var svgNode = xmlDoc.selectSingleNode(“//svg”);
//ActiveDocument.Host.Alert(xmlDoc.xml);
var viewBox = svgNode.getAttribute('viewBox');
var params = viewBox.split(' ');
var SVGwidth = parseFloat(params[2]);
var SVGheightt = parseFloat(params[3]);
//var SVGwidth = svgNode.getAttribute(“width”);
//var SVGheight = svgNode.getAttribute(“height”);Any ideas would be greatly appreciated.
-
AuthorPosts
- You must be logged in to reply to this topic.