🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.framemaker.sgml
9 messages
9 total messages Started by Alex_Masycheff Sun, 19 Oct 2008 09:17
Converting Index Entries with Conversion Tables
#602
Author: Alex_Masycheff
Date: Sun, 19 Oct 2008 09:17
29 lines
1623 bytes
Hi All,

I'm migrating unstructured FM content to XML using conversion tables.

Two questions:

1. I need to preserve index markers and map them to the following structure:

<index>
<indexPrimaryEntry>marker content goes here... </indexPrimaryEntry>
</index>

I set the conversion table in the following way:

M:Index --> indexPrimaryEntry
E:indexPrimaryEntry --> index

This is what I get:

<index><indexPrimaryEntry type = "Index" text = "marker content goes here..."/></index>

Is there a way to make the index entry to be wrapped into <indexPrimaryEntry> directly rather than to its attributes?

2. After applying the conversion table, I save the structured FM file as XML. FrameMaker adds processing instructions for conditional text and other stuff. Because I don't need round-tripping in this specific case, I would like to disable automatic adding of these processing instructions. Is it possible?

Any help is appreciated.

Thank you in advance,
Alex
Re: Converting Index Entries with Conversion Tables
#604
Author: Scott_Prentice
Date: Sun, 19 Oct 2008 15:04
17 lines
1045 bytes
Hi Alex...

1) I believe that you can use the following rule to write the marker text out as content ..

element "indexPrimaryEntry"
{
 is fm marker element;
 marker text is content;
}

2) In the structure application definition file using the following should do what you want ..

ConditionalText/OutputTextPI/OutputAllTextWithoutPIs

Cheers,

...scott
Re: Converting Index Entries with Conversion Tables
#606
Author: Alex_Masycheff
Date: Sun, 19 Oct 2008 19:12
10 lines
1301 bytes
Hi Scott,

Thank you! I have a stupid question, though: what file contains the read/write rules? I don't have any EDD and no structure application was built. What I'm doing is quite straightforward: I've built a conversion table, opened an unstructured FM file, and selected Structure Tools > Utilities > Structure Current Document.

As far as I understand there is a read/write rules files somewhere (a default one?) because in the Structure View of the structured FM file the structure looks OK, but when I save it as an XML file, the contents of indexPrimaryEntry goes to the attribute... So something makes it happen.

Are there any default files?

Thanks!
Alex
Re: Converting Index Entries with Conversion Tables
#608
Author: Lynne_A._Price
Date: Mon, 20 Oct 2008 01:34
20 lines
3199 bytes
Alex,

Using the Structure Current Document sounds quite appropriate for your process. If the resulting formatting is correct, you may not need an EDD. If any elements have context-sensitive formatting, though, you probably will at some point.

Read/write rules and defining a structured application are not relevant until you have structured your document and are ready to save it as XML. There is no default file of read/write rules. Rather, when you save your structured document as XML, FrameMaker has a default representation for every construct. If the default is not acceptable, you can request several common variants of this default behavior with read/write rules. Read/write rules can be entered in text files or in FrameMaker files. You create the file yourself, and then you define an application to use it. See the Structure Application Developer Guide for more information.

By the way, read/write rules are not a general-purpose programming language. In situations that require more complex differences between FrameMaker's default XML representation and the element structure within FrameMaker, you can use the FDK to write a plug-in to move between the two representations. You may also be able to use XSLT to transform one to the other. Both techniques let you use the default behavior as modified by read/write rules as much as necessary, so you need write code only for the exceptional situations.

Also, the XML structure you are using, representing an index marker with an element that has subelements for each level of entry and subentry is not uncommon. As long as you don't have subentries, you can derive both elements through the conversion table. If you do want subentries, though, you'll need to use a different structure in FrameMaker and in XML. In FrameMaker, you'll need to retain all levels in one marker, retaining FrameMaker's index marker syntax so that FrameMaker can build an index. In XML, though, you'll probably need separate elements for each level. In this case, you'll need to use the FDK or XSLT. For example, suppose you are writing a cookbook and want to divide the index entries for "chocolate" into several subcategories. You might have an index marker with the text "chocolate:cake" that you want to represent in XML as

<index>
<indexPrimaryEntry>chocolate</indexPrimaryEntry>
<indexSecondaryEntry>cake</indexSecondaryEntry>
</index>

Since read/write rules do not provide a way to generate this structure, you'll need to usesomething else.



--Lynne
Re: Converting Index Entries with Conversion Tables
#618
Author: Alex_Masycheff
Date: Wed, 22 Oct 2008 15:36
21 lines
1629 bytes
Scott, Lynne,

Thank you for your help! I created a simple structured application and read/write rules following your advice and it's working now! Thank you so much.

There is another thing I need to do, maybe you have some ideas how to do in the most effective way. XML files that I get on output should also contain:

1. the <title> element must have the ID attribute. Ideally, its value should be set automatically. The value is the file name without extension. For example, if the file name is topic1.xml, then the file should contain: <title id="topic1">

2. <title> is followed by a block of meta information, something like this:

<topicMetaInfo>
<author>John</author>
<subject>Computers</subject>
</topicMetaInfo>

This meta info is identical for all the files.

Is it something that can be programmed with FrameScript after conversion is complete? I could easily code it with C++, but maybe there is a quicker/faster/more efficient way to do it?

Thanks a lot,
Alex
Re: Converting Index Entries with Conversion Tables
#620
Author: Rick_Quatro
Date: Wed, 22 Oct 2008 16:24
7 lines
804 bytes
Hi Alex,

FYI, this could be scripted with FrameScript or the FDK. If you want more details, please contact me offlist.

Rick Quatro
rick at frameexpert dot com
585-659-8267
Re: Converting Index Entries with Conversion Tables
#621
Author: Scott_Prentice
Date: Wed, 22 Oct 2008 16:31
13 lines
1720 bytes
Hi Alex...

From what you've shown of your data model, it looks an awful lot like DITA .. have you considered using that? If you did, you'd have support for that from tools that already exist rather than trying to build your own.

Also .. typically (from what I've seen) the ID attribute is on the title's "topic" element rather than on the title itself. When making a cross-ref to the "title" you actually make the cross-ref to the topic and the title is used as the link text.

But, back to your question .. I'm not aware of any default FM way to automatically assign an ID value to elements. I use the FDK for this purpose, but this could also be done with FrameScript or XSLT.

If you're trying to add a common block of elements to a number of files, you can do that with the FDK, FrameScript or XSLT. You might also take a look at the Node Wizard in FrameSLT (from www.weststreetconsulting.com). This is an invaluable tool for processing and working with structured FM files.

Cheers,

...scott
Re: Converting Index Entries with Conversion Tables
#623
Author: Alex_Masycheff
Date: Wed, 22 Oct 2008 17:06
11 lines
1317 bytes
Hi Scott,

Again, thank you!

It looks like DITA indeed (or I'd say more like DocBook), but it's a proprietary XML standard that my client uses. They have been using this standard for many years (I guess, it's older than DocBook) and I'm not sure they would agree to begin moving to the new standard now...

Of course the ID attribute is on the <topic> element, you are right. Kind of typo...

As far as I know, FrameScript enables using MSXML for parsing XML so maybe it'll be a good option. And I'll definitely take a look at FrameSLT, thanks a lot for the advice!

Alex
Re: Converting Index Entries with Conversion Tables
#505
Author: Lynne_A._Price
Date: Thu, 30 Oct 2008 05:52
7 lines
1727 bytes
Alex,

Are you saving a book or a single file as XML? If you are saving a book, then FM can optionally include processing instructions in the generated XML that allow it to recreate the book when it opens the XML. In particular, a processing instruction preceding the content of each book component includes the filename of that book component. In this case, you can set up your XML application to run a simple XSLT transformation that copies the filename (without the extension) from the processing instruction to the desired attribute.

If you are not using processing instructions to indicate the book components, or if you are saving individual FrameMaker files as XML, this technique is not available. In this case, you'll need to use either the FDK (FrameMaker Developer's Kit, which uses C) or FrameScript to modify FrameMaker's export behavior by adding the attribute. With both the FDK and FrameScript, you only have to write code for the elements and attributes you are changing; FrameMaker's default behavior as modified

--Lynne
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads