Copy link to clipboard
Copied
FM11 / DITA 1.2
I'm trying to set up my EDD to automatically add translated autonumbering text to a top-level header.
More specifically: in my English manuals, for paragraph style Head.0, I use the autonumbering text Chapter <$chapnum>:
We translate our manuals into 21 languages, and I want to use the power of EDD to automatically translate the word Chapter based on the xml:lang attribute in the XML. I also want to specify different fonts for some of the languages that don't use the Roman alphabet, but that's probably a separate question (and getting this answered might help me figure that out!)
I have written rules in my EDD like this:
(These rules are under the <dita> element in the EDD)
Format rules for first paragraph in element
If context is: [title != “”]
Use paragraph format: head.0
If context is: * < dita [xml:lang = “en”]
Numbering properties
Autonumber format: Chapter <$chapnum>:
Character format: ~HeaderGray
Else, if context is: * < dita [xml:lang = “bg”]
Numbering properties
Autonumber format: Глава <$chapnum>:
Character format: ~HeaderGray
...and so on.
Below that ruleset is a prefix rule to set the chapter title to the value of the "title" attribute:
Prefix rules
If context is: [title != “”]
Prefix: <$attribute[title]>
Now, what I think I'm telling FrameMaker is this: "Hey FrameMaker, If any element under the <dita> element has the value of the xml:lang attribute set to "foo", follow this rule."
But maybe I've got the syntax incorrect, or my template isn't set up correctly, or I'm just dead wrong about the context, because I can't get this to work despite multiple attempts. The autonumbering does not change at all.
I've tried removing the autonumbering from the head.0 paragraph style in the template on the off chance that the EDD won't override it. For a while, I suspected that maybe having this under the <dita> element is the problem, but that's where all the other chapter title stuff is specified, so I'm not sure about that.
What am I doing wrong?
Thanks in advance for any help.
Hi,
Your context specifications don't do quite what you want:
* < dita [xml:lang = “en”]
doesn't test whether the current element has any ancestor, still within a dita element, with the specified attribute value, but whether the current element has any dita ancestor with that attribute.
Try
*[xml:lang = "en"] < * < dita
or just
*[xml:lang = "en"]
instead.
--Lnne
Copy link to clipboard
Copied
Hi,
Your context specifications don't do quite what you want:
* < dita [xml:lang = “en”]
doesn't test whether the current element has any ancestor, still within a dita element, with the specified attribute value, but whether the current element has any dita ancestor with that attribute.
Try
*[xml:lang = "en"] < * < dita
or just
*[xml:lang = "en"]
instead.
--Lnne
Copy link to clipboard
Copied
Thank you so much!!
The second option did it for me. Much appreciated and thanks for the learning opportunity.
Copy link to clipboard
Copied
Hi Lynne, I have a similar problem with the xml:lang attribute in DITA 1.3. I set this attribute under my dita topic elements, say the root element. Then in the EDD elements, I use the Text format rules to check if those elements have a topic ancestor with an xml:lang attribute set to a certain language. This I do by counting howmany level the element should go up to reach the topic element, e.g. for the title element, I use * < topic[xml:lang = "de"] and for the p element, I use * < * < topic[xml:lang = "de"]. These two cases were successful. But when I try to apply the same principle to the list element it does not check for the language. Are there exceptions for certain elements?
Copy link to clipboard
Copied
Hadih,
First, the interpretation of a context specification is independent of the element type you are formatting--a list element should be treated just like the title.
Second, * in the context specification matches any number of ancestors (including 0). Thus, * < topic[xml:lang = "de"] and * < * < topic[xml:lang = "de"] are interpreted the same way: they both match a child or a topic with xml:lang set to "de", a grandchild of such a topic, a great-grandchild of such a topic, and so forth.
Do you switch languages within a topic, or is the entire topic in one language? If you have a rule such as
If context is: * < ol[xml:lang = "de"] ...
Else, if context is: * < ol[xml:lang = "en"] ...
and have nested lists in which one sets the attribute to "de" and the other to "en", you will always get the "de" result. It doesn't matter whether it's the inner list or the outer list that sets the attribute to "de"; the If clause tests whether the current element has any ancestor that is an ol with xml:lang set to "de". It does, so the If clause fires, and FM never even tests the ElseIf clause.
--Lynne
Copy link to clipboard
Copied
Lynne thanks for explaining. I neither switch languages within a topic element nor within a whole doucument. I have different documents with different languages though. Therefore, I would only set the xml:lang attribute corresponding to the topic element of each xml file. Thus, the xml:lang attribute for the child elements, including ul, ol or li etc. would take no value.
Now in the EDD (mainly commonElements.eddmod.fm) I use the Text format rules for each of these elements to check if the xml:lang attribute of their ancestor topic element has a value. Shall I do this check for the ul and ol or directly for the li element?
Copy link to clipboard
Copied
Hadih,
I will answer this question in the thread on setting the language property based on attributes (https://community.adobe.com/t5/framemaker/how-to-set-fm-spell-checker-language-based-on-xml-lang-att....
--Lynne