• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Use a Variable for "label" Attribute?

Community Beginner ,
Jun 07, 2017 Jun 07, 2017

Copy link to clipboard

Copied

Hi, all.

I am using FM 12.0.4.445. I am required to have the label attribute populated in section, subsection, figure, and table elements. The label attribute is what is used to build the table of contents, therefore, I have to have the label be the section, figure, etc. number. As I'm sure you can imagine, this makes it very difficult to add a section at the beginning because then I have to go back in and rename all of my labels because the sections numbers increment by one. It wouldn't matter if I was only using FM to convert to .pdf, but I have to round trip this to XML to be kept in a database.

Is there a way to make the label attribute of the section, figure, etc. pull the number of that section, figure, etc. with something like <$paranum>? I've tried several different ways and when I save the file as XML, the section number doesn't come in as the label attribute. It comes in as the text "<$paranum>.

Any help would be greatly appreciated. I'm stuck with my DTD and schemas (from 2001). I am not permitted to modify them.

Thanks!

TOPICS
Structured

Views

304

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 07, 2017 Jun 07, 2017

Copy link to clipboard

Copied

Tamwood,

   Is the requirement to populate the attribute an XML requirement or a FrameMaker requirement? If the attribute is only needed in XML, don't bother with it in FrameMaker. Use an XSLT post-process to generate the value in XML.

       --Lynne

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 07, 2017 Jun 07, 2017

Copy link to clipboard

Copied

Thanks for the reply!

It's Structured FM, so the document has to validate in FM as well as XML. To validate when it's in FM, the attribute has to be populated. I'm working with a DTD that was last updated in 2003. IMO, having section numbers as labels and IDs defeats the whole purpose of using XML, but....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 07, 2017 Jun 07, 2017

Copy link to clipboard

Copied

Tamwood,

   Since you are not using the label attribute in FM, you can take it out of your EDD and templates. To remove it from the EDD:

1. Add the following rule to your r/w rules:

       attribute "label" drop;

2. Save a copy of the EDD.

3. Open the EDD

4. Import the DTD into the EDD with Structure > DTD > Import DTD in FM 2017 or StructureTools > Import DTD

5.  Open the saved copy of the EDD.

6. Use File > Utilities > Compare Documents to make sure that the only changes to the EDD was deletion of the label attributes.

Once you have a modified EDD you can import its element definitions into your documents and templates.

   You may need to create a modified DTD as well, which you will use only temporarily. The idea is that you change your XML application to use the modified DTD, which does not define label attributes, and then add the XSLT post-process. When you save your document or book as XML, FM writes a temporary XML file which uses the modified DTD. It then runs XSLT with that temporary XML document as input. The transform creates a new XML document that uses the original DTD and adds the label attributes. Once XSLT is finished, FM deletes the temporary file.

  --Lynne

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 08, 2017 Jun 08, 2017

Copy link to clipboard

Copied

LATEST

Hi tamwood,

As an alternative to Lynne's quite valid suggestion, you could pull this off with an ExtendScript. It would be a relatively short and simple script to refresh these attributes automatically. Do you have any scripting experience?

Russ

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines