Highlighted

Adobe Framemaker does not recognize cross-reference from XML file

New Here ,
May 19, 2017

Copy link to clipboard

Copied

I have an XML file, which I want to generate a Framemaker (tried with both 11 and 2017) document out of it. The following extract shows only the issue-related part:

XML-File (CrossReferenceExample.xml):

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE Root [

<!ELEMENT Root (Section)>

<!ELEMENT Section (Paragraph*)>

<!ELEMENT Paragraph ANY>

<!ELEMENT XRef EMPTY>

<!ATTLIST XRef type CDATA #REQUIRED>

<!ATTLIST XRef text CDATA #REQUIRED>

<!ELEMENT HRef EMPTY>

<!ATTLIST HRef format CDATA #REQUIRED>

<!ATTLIST HRef refid CDATA #REQUIRED>

<!ATTLIST HRef sourcefile CDATA #IMPLIED>

]>

<Root>

  <Section>

    <Paragraph>Hello <XRef type="Cross-Ref" text="world-link"/>world.</Paragraph>

    <Paragraph>Here is the link: <HRef format="Page" refid="world-link"/></Paragraph>

  </Section>

</Root>

Read/write rules (read_write_rules.fm):
element "HRef" {

      is fm cross-reference element;

      attribute "refid" is fm property cross-reference id;

}

element "XRef" {

    is fm marker element;

    marker text is attribute;

}

Application definition:
Application name:    create_reference_example

Read/write rules:    read_write_rules.fm

Import procedure:

File -> Open:  CrossReferenceExample.xml

Use Structured Application: create_reference_example -> ok

=> Alert CrossReferenceExample.xml contains unresolved cross-references. ... -> OK

File opens, XRef seems to be fine, but:

HRef shows "<WHITESPACE>", where as "page 1" would be expected, because the format was selected as "Page".

Adobe Community Professional
Correct answer by Lynne_A__Price | Adobe Community Professional

Christof,

    FrameMaker supports two models of cross-references and you have attempted to use a combination of both. The difference is the way the spot cited by a cross-reference is identified. (In FrameMaker terminology, this spot is called the source, because it is the source of the text that appears when the user inserts a cross-reference. Thinking of the cross-reference as a link, though, it is tempting to refer to this spot as the destination or target of the cross-reference.)

    Marker-based cross-references are used in unstructured documents. The source of the cross-reference is identified by a cross-reference marker in the cited paragraph. That marker can be inserted automatically by FrameMaker when the user selects a paragraph in the cross-reference dialog, or inserted explicitly by the user. Structured documents can contain marker-based cross-references, but such cross-references cannot be round-tripped to XML.

   Following a convention common in XML (and that motivated the definition of ID and IDREF attributes), FrameMaker also supports element-based cross-references. The source of an element-based cross-reference is an element. There is no need to define a new element type to define the elements that will be the target of links. Instead, declare an ID attribute on the elements that you want to cite. The cross-references will use such attributes to identify cross-reference sources.

   In your example, thus, you do not need the XRef element, but you do need to add a new attribute to the Paragraph element. Furthermore, the refid attribute on your HRef element needs to be declared as IDREF instead of CDATA

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE Root [

<!ELEMENT Root (Section)>

<!ELEMENT Section (Paragraph*)>

<!ELEMENT Paragraph ANY>

<!ATTLIST Paragraph

        id ID #IMPLIED

>

<!ATTLIST HRef format CDATA #REQUIRED>

<!ATTLIST HRef refid IDREF #IMPLIED>

]>

<Root>

  <Section>

    <Paragraph id="hello">Hello <XRef type="Cross-Ref" text="world-link"/>world.</Paragraph>

    <Paragraph>Here is the link: <HRef format="Page" refid="hello"/></Paragraph>

  </Section>

</Root>

Read/write rules (read_write_rules.fm):
element "HRef" {

      is fm cross-reference element;

      attribute "refid" is fm property cross-reference id;

}

I have also removed the sourcefile attribute you had declared on HREF. FrameMaker uses an attribute named srcfile for cross-references from one XML document to another, but that's a topic for another forum thread.

    --Lynne

TOPICS
Structured

Views

508

Likes

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

Adobe Framemaker does not recognize cross-reference from XML file

New Here ,
May 19, 2017

Copy link to clipboard

Copied

I have an XML file, which I want to generate a Framemaker (tried with both 11 and 2017) document out of it. The following extract shows only the issue-related part:

XML-File (CrossReferenceExample.xml):

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE Root [

<!ELEMENT Root (Section)>

<!ELEMENT Section (Paragraph*)>

<!ELEMENT Paragraph ANY>

<!ELEMENT XRef EMPTY>

<!ATTLIST XRef type CDATA #REQUIRED>

<!ATTLIST XRef text CDATA #REQUIRED>

<!ELEMENT HRef EMPTY>

<!ATTLIST HRef format CDATA #REQUIRED>

<!ATTLIST HRef refid CDATA #REQUIRED>

<!ATTLIST HRef sourcefile CDATA #IMPLIED>

]>

<Root>

  <Section>

    <Paragraph>Hello <XRef type="Cross-Ref" text="world-link"/>world.</Paragraph>

    <Paragraph>Here is the link: <HRef format="Page" refid="world-link"/></Paragraph>

  </Section>

</Root>

Read/write rules (read_write_rules.fm):
element "HRef" {

      is fm cross-reference element;

      attribute "refid" is fm property cross-reference id;

}

element "XRef" {

    is fm marker element;

    marker text is attribute;

}

Application definition:
Application name:    create_reference_example

Read/write rules:    read_write_rules.fm

Import procedure:

File -> Open:  CrossReferenceExample.xml

Use Structured Application: create_reference_example -> ok

=> Alert CrossReferenceExample.xml contains unresolved cross-references. ... -> OK

File opens, XRef seems to be fine, but:

HRef shows "<WHITESPACE>", where as "page 1" would be expected, because the format was selected as "Page".

Adobe Community Professional
Correct answer by Lynne_A__Price | Adobe Community Professional

Christof,

    FrameMaker supports two models of cross-references and you have attempted to use a combination of both. The difference is the way the spot cited by a cross-reference is identified. (In FrameMaker terminology, this spot is called the source, because it is the source of the text that appears when the user inserts a cross-reference. Thinking of the cross-reference as a link, though, it is tempting to refer to this spot as the destination or target of the cross-reference.)

    Marker-based cross-references are used in unstructured documents. The source of the cross-reference is identified by a cross-reference marker in the cited paragraph. That marker can be inserted automatically by FrameMaker when the user selects a paragraph in the cross-reference dialog, or inserted explicitly by the user. Structured documents can contain marker-based cross-references, but such cross-references cannot be round-tripped to XML.

   Following a convention common in XML (and that motivated the definition of ID and IDREF attributes), FrameMaker also supports element-based cross-references. The source of an element-based cross-reference is an element. There is no need to define a new element type to define the elements that will be the target of links. Instead, declare an ID attribute on the elements that you want to cite. The cross-references will use such attributes to identify cross-reference sources.

   In your example, thus, you do not need the XRef element, but you do need to add a new attribute to the Paragraph element. Furthermore, the refid attribute on your HRef element needs to be declared as IDREF instead of CDATA

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE Root [

<!ELEMENT Root (Section)>

<!ELEMENT Section (Paragraph*)>

<!ELEMENT Paragraph ANY>

<!ATTLIST Paragraph

        id ID #IMPLIED

>

<!ATTLIST HRef format CDATA #REQUIRED>

<!ATTLIST HRef refid IDREF #IMPLIED>

]>

<Root>

  <Section>

    <Paragraph id="hello">Hello <XRef type="Cross-Ref" text="world-link"/>world.</Paragraph>

    <Paragraph>Here is the link: <HRef format="Page" refid="hello"/></Paragraph>

  </Section>

</Root>

Read/write rules (read_write_rules.fm):
element "HRef" {

      is fm cross-reference element;

      attribute "refid" is fm property cross-reference id;

}

I have also removed the sourcefile attribute you had declared on HREF. FrameMaker uses an attribute named srcfile for cross-references from one XML document to another, but that's a topic for another forum thread.

    --Lynne

TOPICS
Structured

Views

509

Likes

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
May 19, 2017 0
Mentor ,
May 19, 2017

Copy link to clipboard

Copied

Hi christofg11721369,

I've been doing XML and FrameMaker for a number of years, but I am far from the expert. So, I'm just going to throw out a few things. Your setup seems incorrect in many ways and suggests that you need to study the Structure Developers Guide for a while. This process can be complicated and I suspect that you are some distance from a good understanding. That is, I am not sure that anyone can solve this for you over a short forum exchange.

It seems that both your read write rules and your structural setup are incorrect. For your structure, an FM xref element would never target an empty element, such as this <XRef> element. It requires a text containing element to auto-generate the xref text. This is the FM model. So, the XRef element is superfluous. Plus, that all seems backwards anyway, that the <XRef> element should be the xref, not the target. Furthermore, your attribute setup and read/write rule definitions don't make much sense at all to me.

Perhaps someone else might be able to provide a quick set of instructions for a quick fix, but in my estimation, you might need to get back to the basics for a while. I hope you don't take this the wrong way... I just wanted to be sure you at least got a response to your post. This forum is a great resource but we are limited in what we can do over this medium.

Russ

Likes

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
Reply
Loading...
May 19, 2017 0
New Here ,
May 19, 2017

Copy link to clipboard

Copied

Hi Russ

Thanks for your answer. I have studied the Structure Developers Guide, but I will dig into it further.

Have you ever got a marker -> cross-reference example from XML working? Would you be able to share a minimum example? I was trying to find any working example in the internet but was not able.

Thanks in advance and best regards,

Christof

Likes

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
Reply
Loading...
May 19, 2017 0
Adobe Community Professional ,
May 19, 2017

Copy link to clipboard

Copied

Christof,

    FrameMaker supports two models of cross-references and you have attempted to use a combination of both. The difference is the way the spot cited by a cross-reference is identified. (In FrameMaker terminology, this spot is called the source, because it is the source of the text that appears when the user inserts a cross-reference. Thinking of the cross-reference as a link, though, it is tempting to refer to this spot as the destination or target of the cross-reference.)

    Marker-based cross-references are used in unstructured documents. The source of the cross-reference is identified by a cross-reference marker in the cited paragraph. That marker can be inserted automatically by FrameMaker when the user selects a paragraph in the cross-reference dialog, or inserted explicitly by the user. Structured documents can contain marker-based cross-references, but such cross-references cannot be round-tripped to XML.

   Following a convention common in XML (and that motivated the definition of ID and IDREF attributes), FrameMaker also supports element-based cross-references. The source of an element-based cross-reference is an element. There is no need to define a new element type to define the elements that will be the target of links. Instead, declare an ID attribute on the elements that you want to cite. The cross-references will use such attributes to identify cross-reference sources.

   In your example, thus, you do not need the XRef element, but you do need to add a new attribute to the Paragraph element. Furthermore, the refid attribute on your HRef element needs to be declared as IDREF instead of CDATA

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE Root [

<!ELEMENT Root (Section)>

<!ELEMENT Section (Paragraph*)>

<!ELEMENT Paragraph ANY>

<!ATTLIST Paragraph

        id ID #IMPLIED

>

<!ATTLIST HRef format CDATA #REQUIRED>

<!ATTLIST HRef refid IDREF #IMPLIED>

]>

<Root>

  <Section>

    <Paragraph id="hello">Hello <XRef type="Cross-Ref" text="world-link"/>world.</Paragraph>

    <Paragraph>Here is the link: <HRef format="Page" refid="hello"/></Paragraph>

  </Section>

</Root>

Read/write rules (read_write_rules.fm):
element "HRef" {

      is fm cross-reference element;

      attribute "refid" is fm property cross-reference id;

}

I have also removed the sourcefile attribute you had declared on HREF. FrameMaker uses an attribute named srcfile for cross-references from one XML document to another, but that's a topic for another forum thread.

    --Lynne

Likes

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
Reply
Loading...
May 19, 2017 0
New Here ,
May 19, 2017

Copy link to clipboard

Copied

Lynne, thanks a lot!

This solution works perfectly! Only edit to your solution was that I had to add the <!ELEMENT HRef EMPTY> again. So the complete solution is now:

XML file:

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE Root [

<!ELEMENT Root (Section)>

<!ELEMENT Section (Paragraph*)>

<!ELEMENT Paragraph ANY>

<!ATTLIST Paragraph id ID #IMPLIED>

<!ELEMENT HRef EMPTY>

<!ATTLIST HRef format CDATA #REQUIRED>

<!ATTLIST HRef refid IDREF #IMPLIED>

]>

<Root>

  <Section>

    <Paragraph id="hello">Hello world.</Paragraph>

    <Paragraph>Here is the link: <HRef format="Page & Heading" refid="hello"/></Paragraph>

  </Section>

</Root>

Read/write rules (read_write_rules.fm):

element "HRef" {

      is fm cross-reference element;

      attribute "refid" is fm property cross-reference id;

}

Result in Framemaker:

Hello world.

Here is the link: *** 'Hello world.' on page 1 ***

Thanks again and best regards,

Christof

Likes

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
Reply
Loading...
May 19, 2017 0
Mentor ,
May 22, 2017

Copy link to clipboard

Copied

Christof, I'm glad you got an answer! It was more I could figure out in short order. Thank you Lynne, once again.

Russ

Likes

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
Reply
Loading...
May 22, 2017 0