Skip to main content
Rsfl
Inspiring
May 28, 2014
Question

Autoinsert with predefined attributes?

  • May 28, 2014
  • 2 replies
  • 346 views

Hi, is there a possibility to use an autoinsertion in the EDD that specifies an attribute of the inserted element? I envision something like the following so insert a 'data' element that has the attribute 'name' set to 'source'..

Automatically insert child:data[name="source"]

My Structure Application Developer Guide is outdated (FM8) but I could not find a newer version yet..

Robert

This topic has been closed for replies.

2 replies

Inspiring
May 29, 2014

Robert,

As Scott has said, FM does not support autoinsertion of attributes. If there is only one attribute value you want to use, you can make that value the default and assign formatting based on that value. If you do want to support multiple values, within FM you can use different element types, each corresponding to a different value (e.g., elements such as data-name-source, data-name-other, ...). You can then use XSLT to map the various element types to a single type with an attribute to distinguish them (so that data-name-source becomes <data name="source"> and data-name-other becomes <data name="other"> and so forth).

     --Lynne

Rsfl
RsflAuthor
Inspiring
May 30, 2014

Thanks for the infos. Regrettably we cannot use plugins for this (people at different locations will work with the documents).

The main use would have been to auto-insert a set of data elements for handling HTML5 video objects, and to make it a bit more convenient for the author.

We use a structure like this:

<fig>

<figgroup outputclass="video">

  <title>Video title (optional)</title>

<data name="width " value="int"/>

<data name="height" value="int"/>

<data name="controls" value="bool"/>

<data name="poster" value="video.jpg"/>

<data name="source" value="video.mp4"/>

<data name="source" value="video.ogg"/>

</figgroup>

</fig>

ScottPrentice
Inspiring
June 2, 2014

Note that the "snippets" that are added are nothing more than a copy+paste of the specified structure. If one person is using the plugin, it doesn't affect others ability to work with that file. But I do understand the inconvenience of trying to install plugins on multiple systems.

THe "low tech" way to handle this is to create "snippet" file that is available to everyone, and you just copy+paste from that file into your topic. If the content is always the same, that's actually a perfect use for conrefs, but if it needs to be modified (as I'm sure it would in your example), you might just try the copy+paste method.

Cheers,

…scott

ScottPrentice
Inspiring
May 28, 2014

Hi Robert...

Nope. As far as I know this isn't possible using standard EDD (scripting is needed).

I do offer a plugin called Structure Snippets that lets you do that by inserting a predefined "snippet" ..

     http://leximation.com/tools/info/structuresnippets.php

Cheers,

…scott

Scott Prentice

Leximation, Inc.

www.leximation.com