Pages: 1
Print
Author Topic: Using variables in XMetal (a.k.a. keywords?)  (Read 1294 times)
academiceditor
Member

Posts: 2


« on: October 16, 2015, 09:15:08 AM »

Hello,

I'm relatively new to XMetal, with some experience in web programming (HTML, CSS, Javascript, PHP). I work with an academic website publishing a vast amount of pages/information using a Documentum-based CMS, XMetal for editing XML and DITA files, and output generated in a Drupal WMS. There is certain information that is repeated a lot, and changes often, on the site (ex.: academic years, contact names, etc.) so the first thing that came to mind is replacing all instances of these with variables (ex.: var contact1 = "John Smith"; in Javascript, or <?php $acadYear = "2015-2016"; ?> in PHP).

Does XMetal have something equivalent to variables? I heard "keywords" can do the job, so can anyone explain how these work and how to use them? I'm working on XMetal Author Enterprise 7.0.

Thank you so much in advance for your help! :)
« Last Edit: October 16, 2015, 12:26:30 PM by academiceditor » Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2450



WWW
« Reply #1 on: October 16, 2015, 01:55:05 PM »

Do you have a specific schema you plan to work with?

DITA for example, defines a few things that may give you what you are looking for, and these are supported by XMetaL Author Enterprise and the DITA Open Toolkit. The DITA authoring solution included with XMetaL Author Enterprise has an extensive user interface dedicated to helping you create and manage these.
If you plan to use DITA look up these topics in the Help:
Working with DITA > Content references
Working with DITA > Conditional text
Working with DITA > Key references

You mention "keywords", which is also part of the DITA specification and supported by XMetaL Author Enterprise. Given the rest of your post, I don't think these are what you are after. I suspect you may have been told about "key references". As these can be confusing for someone new to DITA you may wish to start with "content references". You may find that they do not meet your needs and that you need something more powerful, at which point you might decide "key references" are what you need.

Some schemas (like DocBook) support an XML standard called "XML Inclusion" (aka: XInclude). XMetaL Author supports this standard (as well as XPointer, which is related to XInclude) but to use XML inclusions in your XML your schema must define the appropriate elements as defined by the W3C XML Inclusion Recommendation. This means you can use it with any schema provided that schema defines the elements, or provided you can alter the schema to define them.

People will use these in different ways so they may require a specific user interface for helping their users to work with them. For that reason XMetaL Author does not include a predefined interface for this. Instead, several APIs are available for building a UI your users might require. In general you can work with these as you would with any other element and its associated attributes using the Element List and Attribute Inspector however (if you don't require specific functionality). The APIs specific to XInclude are documented in the XMetaL Developer Programmers Guide.

The DocBook sample customization included with XMetaL Author demonstrates one way you might use XInclude. To see that in action open the "Anatomy and Physiology" sample or the "Hello World in MMIX" sample. These are listed in the Help menu under Samples. Right clicking on an <xi:include> element will show you options specific to XInclude. These options are added to that menu using script and in turn selecting one of them runs more script (calling the appropriate API). Scripts are defined as "macros" inside the MCR file associated with the DocBook sample customization.

For more information on the standard see http://www.w3.org/TR/xinclude/

XML (in general) defines several types of entities. These can reference text or files. Entities are part of the XML Recommendation and as such are supported in any document without specific requirements needed in the schema. I would strongly recommend not using them with any schema that defines an alternative option (such as those listed above). They are generic in nature (which can be both a good and bad thing) but for any schema that has defined an alternative that alternative will generally have advantages over entities (otherwise the alternative would not have been invented) and the alternative will also be better supported by any tools designed to work specifically with that schema.

See this topic and the topics it links to: Authoring structured content > Working with entities
See also sections 4 through 4.6 in the XML Recommendation: http://www.w3.org/TR/xml/#sec-physical-struct




« Last Edit: October 16, 2015, 02:00:23 PM by Derek Read » Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2450



WWW
« Reply #2 on: October 16, 2015, 02:07:30 PM »

Please note that version 7 is very old. If you are working with DITA and you can upgrade I would suggest doing so as the DITA authoring solution has been improved a lot since version 7. It also has improved support for these specific DITA features. The current release is 10.

If you are interested in XML entities or XInclude then there is less reason to upgrade as these standards have not changed for many years so the features that support them in XMetaL Author have not needed to be updated. I would still upgrade anyway however as there have been many hundreds of other improvements in the software since version 7.
Logged
academiceditor
Member

Posts: 2


« Reply #3 on: October 20, 2015, 01:21:00 PM »

Hi Derek,

Thanks very much for the detailed help! I looked into different options you mentioned, and it seems I'll have to work closely with our IT department to unlock this functionality. Turns out I'm working on a customized version of XMetal 8 (not 7, as I mentioned earlier).

I'll try to follow up once we make some progress. In the meantime, I guess I'll be doing a lot of "hard-coding"...

Cheers,
Andrea
Logged
Pages: 1
Print
Jump to:  

email us