0

I've been using InDesign for a few years now but only just started to learn using the XML to tag, create XSLT & CSS styles. I've found an example in a book which I've used for the XSLT & adapted it to use the structure in a simple InDesign document so I can understand it fully before setting up my proper documents. I have the CSS created which I've done through HTML (minus any reference to doc types at the top, just styles only). Every time I try to import the XML file back into InDesign using the XSLT (which calls up the CSS), I keep getting the following error code:

text format specified by 'xsl:output method='is not appropriate for a DOM

Please can anybody help me to understand where I've gone wrong & what I need to change?

My XSLT is as follows:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet  [
    <!ENTITY nbsp   "&#160;">
    <!ENTITY copy   "&#169;">
    <!ENTITY reg    "&#174;">
    <!ENTITY trade  "&#8482;">
    <!ENTITY mdash  "&#8212;">
    <!ENTITY ldquo  "&#8220;">
    <!ENTITY rdquo  "&#8221;">
    <!ENTITY pound  "&#163;">
    <!ENTITY yen    "&#165;">
    <!ENTITY euro   "&#8364;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

    <xsl:template match="/">

        `enter code here`<html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <!-- This text is within a comment area. It does not format or affect the file in any way. Insert the link to the external CSS file in the blank line below -->
            <link href="Mandy.css" rel="stylesheet" type="text/css" />
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        </head>
        <body>

            <div id="heading">
                <h1>
                    <xsl:apply-templates select="html/head"/>
                </h1>
            </div>

            <div id="body">
                <h1>
                    <xsl:apply-templates select="html/head/body"/>
                </h1>
            </div>

            <div id="div">
                <h1>
                    <xsl:apply-templates select="html/head/body/div"/>
                </h1>
            </div>


        </body>
    </html>
</xsl:template>

The entities are irrelevant as they are copied over from the example.

My CSS is as follows:

p {
    text-indent: 0mm;
    margin-left: 12mm;
    margin-right: 8mm; 
    font-family:"Arial-Regular", sans-serif;
    font-size: 1.6em;
    }
pb {
    text-indent: 10mm;
    margin-left: 20mm;
    margin-right: 8mm;
    font-style:bold;
    font-family:"Arial-Regular", sans-serif;
    font-size: 1.6em;
    }
pf {
    text-align: justify;
    font-family:"Arial-Regular", sans-serif;
    font-size: 1.6em;
    font-style:normal;
    margin-left:2mm;
   }


h1 {
    text-align: left;
    padding-top: 5mm;
    padding-bottom: 5mm;
    font-family:"Arial-Regular", sans-serif;
    font-size: 4em;
    font-style:normal;
    line-height:100%
    }
h2 {
    text-align: left;
    margin-left:2mm;
    padding: 0mm 0mm 0mm 0mm;
     font-family:"Arial-Regular", sans-serif;
    font-size: 2.5em;
    font-style:normal;
    line-height:100%
    }    
h3 {
    text-align: left;
    padding: 0mm 0mm 0mm 0mm;
    font-family:"Arial-Regular", sans-serif;
    font-size: 1.6em;
    font-style:normal;
    line-height:100%
        }

ul.a {
    text-indent: 100px
        list-style-position: inside;
    font-family:"Arial-Regular", sans-serif;
    font-size: 1.6em;
    font-style:normal;      
    }

ul.b {
        text-indent: 100px
        list-style-position: inside;
    style="list-style-type:disc"
    font-family:"Arial-Regular", sans-serif;
    font-size: 1.6em;
    font-style:normal;      
    }

tr.left {
    text-align: left;
    font-family:"Arial-Regular", sans-serif;
    font-size: 1.6em;
   }
tr.center {
    text-align: center;
    font-family:"Arial-Regular", sans-serif;
    font-size: 1.6em;
   }
tr.right {
    text-align: right;
    font-family:"Arial-Regular", sans-serif;
    font-size: 1.6em;
   }
td.left {
    text-align: left;
    font-family:Arial-Regular, sans-serif;
    font-size: 1.6em;
    border-collapse: collapse;
    }
td.center {
    text-align: center;
    font-family:Arial-Regular, sans-serif;
    font-size: 1.6em;
    border-collapse: collapse;
    }
td.right {
    text-align: right;
    font-family:Arial-Regular, sans-serif;
    font-size: 1.6em;
    border-collapse: collapse;
    }
th.left {
    text-align: left;
    font-family:Arial-Regular, sans-serif;
    font-size: 1.6em;
    border-collapse: collapse;
    }
th.center {
    text-align: center;
    font-family:Arial-Regular, sans-serif;
    font-size: 1.6em;
    border-collapse: collapse;
    }
th.right {
    text-align: right;
    font-family:Arial-Regular, sans-serif;
    font-size: 1.6em;
    border-collapse: collapse;
    }
Carl Binalla
  • 5,393
  • 5
  • 27
  • 46
  • 1
    I know nothing about InDesign, but try changing `method="html"` to `method="xml"` or `method="xhtml"`. – Daniel Haley Jul 19 '17 at 18:26
  • Is the `enter code here` text in your XSLT a copy-paste mistake? – Eiríkr Útlendi Jul 20 '17 at 00:02
  • Hi Eiríkr Útlendi & Daniel Haley, yes the 'enter code here' is a mistake & not sure where that came from! I've tried method="html" & method="xml" but not xhtml so will try that. Thank you. – Mandy Bailey Jul 20 '17 at 09:56
  • 1
    XML Import within InDesign has nothing to do with HTML/CSS. On best case scenario the raw html syntax might be importable as XML because html is XML but XML on import has to be XML and to be set so. So setting the output method to xml is the very first step. Second of all, you can't count on CSS to have your XML properly styled within InDesign. The app just doesn't know what CSS are and how to process them visually. Styling XML in indesign implies using tags to styles associations or to use specific namespaced attributes such as pstyle, cstyle or table/cell styles. – Loic Jul 20 '17 at 11:38
  • If you are importing and are applying the xslt to xml while importing the result of the xslt would need to be xml. It appears you wish to import xhtml but I'm not sure the result will be what you expect. Have you tried applying the xslt externally, before doing the import? – user1754036 Jul 20 '17 at 12:05

0 Answers0