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

FrameMaker tab character via XSLT

Community Expert ,
Apr 30, 2020 Apr 30, 2020

Copy link to clipboard

Copied

Hi, I am using XSLT to transform some XML for import into FrameMaker. I need an entity or character in my XML that will import as a FrameMaker tab character. I tried \t and 	 but they both come in as a single space. Any help would be appreciated.

TOPICS
Scripting , Structured

Views

3.3K

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

correct answers 1 Correct answer

Community Expert , May 09, 2020 May 09, 2020

I had to set this flag in the maker.ini:

[Preferences]

RemoveExtraWhiteSpacesOnXMLImport=Off

 

In my stylesheet, I am using 
 for a soft-return and 	 for a tab character. I am glad this works, however, I think it is a poor design choice to have this in the maker.ini because, as far as I know, this setting is persistent for a FrameMaker session. It would be better if I could turn this on and off based on my structured application.

Votes

Translate

Translate
Community Expert ,
Apr 30, 2020 Apr 30, 2020

Copy link to clipboard

Copied

<entry>
  <marker text="openObjectId 10.1.fm:2 1185846"/>
  <text>Operations in Icing Conditions	10.1.22</text>
</entry>

There is a table character between the text and the section number, but when I import into FrameMaker, it gets flattened to a single space. I would like it to come in to FrameMaker as a tab character.

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 ,
May 01, 2020 May 01, 2020

Copy link to clipboard

Copied

Hi Rick,

 

Somebody like Lynne might come by with the correct answer, but I wonder, is there any way to just put a tab in your XML source? It is within the ASCII range and should import as an FM tab.

 

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
Community Expert ,
May 01, 2020 May 01, 2020

Copy link to clipboard

Copied

Hi Russ,

I thought so too as it shows as a tab when I transform through Oxygen, but in FrameMaker, it comes in as a single space character. For expediency, I added a <tab> element between the title and page number and have a prefix rule in the EDD that adds a tab. It is for a custom "generated" document so it won't interfere with editing, but I think I am missing something obvious.

Rick

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 ,
May 01, 2020 May 01, 2020

Copy link to clipboard

Copied

Well, I'm not slick on entities and such, so I can't speculate much more on that. But I do know that FM exports a tab as ASCII 9 (decimal) and imports it just fine. If you can get character code 9 in there, it seems it should work. Sorry I can't be of more help.

 

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
Community Expert ,
May 09, 2020 May 09, 2020

Copy link to clipboard

Copied

I had to set this flag in the maker.ini:

[Preferences]

RemoveExtraWhiteSpacesOnXMLImport=Off

 

In my stylesheet, I am using &#13; for a soft-return and &#x9; for a tab character. I am glad this works, however, I think it is a poor design choice to have this in the maker.ini because, as far as I know, this setting is persistent for a FrameMaker session. It would be better if I could turn this on and off based on my structured application.

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 Expert ,
May 09, 2020 May 09, 2020

Copy link to clipboard

Copied

Correction on "poor design choice": This property is actually exposed so it can be set programmatically so the maker.ini doesn't have to be changed. I can simply use this in my script:

app.RemoveExtraWhiteSpacesOnXMLImport = 0;

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 ,
May 09, 2020 May 09, 2020

Copy link to clipboard

Copied

Russ, Rick,

    Handling white space is very difficult because there are numerous situations that look the same but users want to be handled differently. How do you process something that you can't see? There are many use cases that require importing pretty-printed XML where indentation is caused by tab characters. There are other cases where tabs are significant for displaying a screen layout or something similar. Sometimes white space characters can be inserted as entity references, possoibly mapped to FM variables. Users might think about white space created by an automatic process such as XML export from FM differently than they do about white space explicitly entered by a user. I believe automatic determination about the significance of white space is one of the hardest things to define in text processing.

    --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 Expert ,
May 09, 2020 May 09, 2020

Copy link to clipboard

Copied

Hi Lynne, Thank you for your post. I agree that white space can be tricky to figure out and process. However, I was a little surprised that output created with this <xsl:text>&#x9;</xsl:text> in my stylesheet became a single space on import to FrameMaker. The same with this: <xsl:text>&#13;</xsl:text>. When I set this before import:

 

app.RemoveExtraWhiteSpacesOnXMLImport = 0;

 

I get the desired characters on import. -Rick

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 Expert ,
May 09, 2020 May 09, 2020

Copy link to clipboard

Copied

LATEST

By the way, this is part of a technique that I am starting to use for “custom” generated files. The client has a TOC with 2 levels of headings. They want the 1st level sorted alphabetically, while the 2nd level underneath each level 1 stays in document order. I used to do the sorting with a script, but it meant using the clipboard to move things around. Now I am doing this with a script:

  1. Save the generated TOC as XML using the built-in Save As XML.
  2. Read a structapps file that is set up with a simple application for the sorted TOC.
  3. Open the XML file. The application uses an XSLT stylesheet to group on the level 1 entries and sort them, keeping the level 2 entries underneath the appropriate level 1 entries. The stylesheet also has a line-break algorithm based on character count.
  4. The script then saves the custom structured TOC over the original one.
  5. Read the default structapps.fm file back into memory.

 

If I can get permission from the client, I would like to record a video to demonstrate the technique. I have also used it to make custom generated files that use tables for the content. The idea is to leverage the power of XSLT, even in unstructured books.

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