Skip to main content
November 2, 2012
Question

Can you reorder cells using Read/Write rules?

  • November 2, 2012
  • 2 replies
  • 910 views

I’m trying to reorder some table cells during conversion from SMGL to FM10, but I think the Read/Write rules don’t really do what I want them to do.

Here’s what I’ve got in SGML:

<data>

               <cus>B</cus>

               <mod>A</mod>

               <cec>D</cec>

               <acn>C</acn>

</data>

What I want is:

A

B

C

D

My read/write rules are:

}

element "data" {

  is fm table row element;

}

element "cus" {

  is fm table cell element;

  fm property column number value is "2";

  fm property row type value is "Data";

}

element "mod" {

  is fm table cell element;

  fm property column number value is "1";

  fm property row type value is "Data";

}

element "cec" {

  is fm table cell element;

  fm property column number value is "4";

  fm property row type value is "Data";

}

element "acn" {

  is fm table cell element;

  fm property column number value is "3";

  fm property row type value is "Data";

}

What I end up with is each element in its proper cell, but not in the same row:

B

A

D

C


My guess it that FM reads down the SGML and applies the rules to each line as it comes to it, therefore it reads the first line and puts “B” in column 2, then it reads the second line and puts “A” in the next available column 1, which is actually in the next row. Is there a way to keep them in the same row without changing the SGML?

Thanks!

ebpdx

This topic has been closed for replies.

2 replies

Inspiring
November 2, 2012

you can't do this with RW-Rules. But you can define an XSLT in your structured application, which does the restructuring process of you input xml.

hope this helps

November 2, 2012

Unfortunately, I've got SGML files, not XML files and the conversion from SGML to XML is really messy. Oh well, thanks for your help!

ebpdx

Inspiring
November 2, 2012

But you can do it in a second step.

Import SGML Files and you've got a structured FM Document.

Now you can do an XML roundtrip in an easy way and restructure that table in that step.

You can also use FrameSLT (http://www.weststreetconsulting.com/WSC_FrameSLT.htm) if you want to do it in FM document directly.
Hope this helps
Markus

November 2, 2012

It looks like rule order matters here. Have you tried putting the 'mod' rule first, then the 'cus' rule, and so on?

November 2, 2012

Yes, it didn't help.