Skip navigation
Currently Being Moderated

Importing CALS XML tables with oasis namespace

Apr 6, 2012 6:34 AM

Tags: #cs5 #import #xml

Hi all,

 

I'm trying to import XML into InDesign and am running into problems with the tables.  The tables are Oasis CALS tables, and I have the "import CALS tables as InDesign tables" box checked at import.  But, the tables aren't rendering as InDesign tables when they're placed.  Each element is placed in its own paragraph.

 

As a test, I removed the oasis: namespace from the table elements. When I imported the modified XML, the table rendered as an InDesign table.  Does InDesign have trouble with namespaces?  The namespace is declared and the XML parses against the DTD.

 

It would be much easier/faster if I could get this to import correctly without having to worry about XSLT or other major changes to the XML.  Any ideas?

 

Here's some of my XML:

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

<!DOCTYPE book SYSTEM "book-oasis3.dtd">

<book dtd-version="3.0" xml:lang="EN" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:oasis="http://docs.oasis-open.org/ns/oasis-exchange/table">

<body>

<book-part>

<table-wrap>

<label>Table 1 </label><caption><title>Assumed Expected Returns, Variances, and Correlation: Two-Asset Case</title></caption>

<oasis:table frame="none"><oasis:tgroup cols="3">

<oasis:colspec colnum="1" colname="col1" colwidth="33.34%"/>

<oasis:colspec colnum="2" colname="col2" colwidth="33.33%"/>

<oasis:colspec colnum="3" colname="col3" colwidth="33.33%"/>

<oasis:thead>

<oasis:row>

<oasis:entry rowsep="1" valign="top" align="left" colsep="0"></oasis:entry>

<oasis:entry valign="bottom" rowsep="1" align="center" colsep="0"><bold>Asset 1</bold><break/><bold>Large-Cap Stocks</bold></oasis:entry>

<oasis:entry valign="bottom" rowsep="1" align="center" colsep="0"><bold>Asset 2</bold><break/><bold>Government Bonds</bold></oasis:entry></oasis:row></oasis:thead>

<oasis:tbody>

<oasis:row>

<oasis:entry valign="top" align="left" colsep="0" rowsep="0">Expected return</oasis:entry>

<oasis:entry valign="middle" align="char" char="%" colsep="0" rowsep="0">15%</oasis:entry>

<oasis:entry valign="middle" align="char" char="%" colsep="0" rowsep="0">5%</oasis:entry></oasis:row>

<oasis:row>

<oasis:entry valign="top" align="left" colsep="0" rowsep="0">Variance</oasis:entry>

<oasis:entry valign="middle" align="char" char="." colsep="0" rowsep="0">225</oasis:entry>

<oasis:entry valign="middle" align="char" char="." colsep="0" rowsep="0">100</oasis:entry></oasis:row>

<oasis:row>

<oasis:entry valign="top" align="left" colsep="0" rowsep="0">Standard deviation</oasis:entry>

<oasis:entry valign="middle" align="char" char="%" colsep="0" rowsep="0">15%</oasis:entry>

<oasis:entry valign="middle" align="char" char="%" colsep="0" rowsep="0">10%</oasis:entry></oasis:row>

<oasis:row>

<oasis:entry valign="top" align="left" colsep="0" rowsep="0">Correlation</oasis:entry>

<oasis:entry valign="middle" align="char" char="." colsep="0" rowsep="0">0.5</oasis:entry>

<oasis:entry valign="middle" align="left" colsep="0" rowsep="0"></oasis:entry></oasis:row></oasis:tbody></oasis:tgroup></o asis:table>

</table-wrap>

  </book-part>

</body>

</book>

 

 

Thanks!

 
Replies
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Apr 6, 2012 10:33 PM   in reply to mdean215

    As a test, I removed the oasis: namespace from the table elements. When I imported the modified XML, the table rendered as an InDesign table.  Does InDesign have trouble with namespaces?  The namespace is declared and the XML parses against the DTD.

    Yes, it has trouble with namespaces.

    I myself have trouble with namespaces so I'm never sure what is a bug, what is some confusion on my part, and what is proper behavior. But yeah....

     

    It would be much easier/faster if I could get this to import correctly without having to worry about XSLT or other major changes to the XML.  Any ideas?

    Well, this is pretty trivial XSLT, right?

    What's the concern?

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Apr 13, 2012 8:37 PM   in reply to mdean215

    There's one more thing I need to deal with - we have some local formatting in our XML (<bold>, <italic>, etc.) that's being dropped completely.  I'm not sure how I'll deal with that because the XML tags are removed.

    Have you set up XML Tag to Style mapping?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 7:16 AM   in reply to mdean215

    As per InDesign, CALS table should be looks like below:

     

    <table>

    <tgroup>

    <thead>

    <row>

    <entry>...</entry>

    <entry>...</entry>

    </row>

    </thead>

    <tbody>

    <row>

    <entry>...</entry>

    <entry>...</entry>

    </row>

    </tbody>

    </tgroup>

    </table>

     

    And InDesign will remove any sub tags inside the <entry>...</entry> tags. Hope this helps. So to achieve table handling, you need to completely use other pattern like using of InDesign's table namespaces.

     

    Thanks,

     

    Praveen

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Apr 18, 2012 7:17 AM   in reply to mdean215

    I was afraid you'd say that.

    I haven't tried to do this, but I kind of fear it might be a serious limitation of ID's XML import.

    Or at least the CALS tables.

     

    I assume the tags don't show up either, in the structure pane or elsewhere?

     

    I guess I would try them in a non-CALS table and see if they worked, and if so, consider transforming the cals table into a regular ID table. This is nontrivial.

     

    It might be easier to try InDesign Tagged Text, if that works for you? But it has some of the same problems...

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Apr 18, 2012 7:19 AM   in reply to Gejaraja

    So to achieve table handling, you need to completely use other pattern like using of InDesign's table namespaces.

    namespaces? XML namespaces? What?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 7:24 AM   in reply to John Hawkinson

    It's InDesign namespaces like <entry aid:table="cell" aid:crows="1" aid:ccols="1" aid:pstyle="T col hd" aid:theader="" colname="col1" align="left">.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Apr 18, 2012 2:17 PM   in reply to Gejaraja

    OK, Gejaraja, I think I see what you're saying:

    It's InDesign namespaces like <entry aid:table="cell" aid:crows="1" aid:ccols="1" aid:pstyle="T col hd" aid:theader="" colname="col1" align="left">.

    You don't mean to use namespaces, you mean to use the InDesign attributes (which happen to fall in the aid: and aid5: namespaces) of the entry tag.

     

    I'm not sure that works in CALS tables, but it's sure worth a try. mdean, does specifying <entry aid:cstyle="xxx"> where xxx is a character style for boldface or italic work? If so, then it's again an easy XSL transformation, asusming that an entire cell is formatted the same.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points