eacutes driving me nuts

Subject: eacutes driving me nuts
From: Deirdre Saoirse Moen <deirdre@xxxxxxxxxxx>
Date: Wed, 9 Jun 2004 20:57:07 -0700
First, I'm using apache-fop to generate PDF from XML/XSL.

I have a document (XML) that has eacutes, generated from a text file. All the other documents I've tried with no high ASCII characters work fine. Because I hadn't anticipated high ASCII problems (hey, I'm new), I hadn't substituted them with anything. However, my attempts to do so have not been successful and web searches haven't provided anything that's helpful.

FWIW, I've tried variants of an entity declaration of <!ENTITY eacute "&#142;" > (I'm on a Mac so it's not 233), &#amp;#eacute; and so on. I get the same error message regardless (see below).

I guess my question is: do I need to do something in the XML phase (i.e. the input) or the XSL phase (i.e. the transform)? Or both? So far, I've tried only the former and needed migraine medication from the head-thumping.

If someone could aim me in the right direction, I'd appreciate it. I apologize for the message being so long, but I wanted to make it easier for someone to help me.

Here's the bones of the XML file (novel-template.xml) in question (I've omitted much of it, but essentially the ENTITY declarations are designed to include the chapters of the novel):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE novel SYSTEM 'prose.dtd'
  [
      <!ENTITY ch03 SYSTEM "iop-chap-03.xml">
  ] >
  <novel>
    <title>Isle of Pearls</title>
    <author>Deirdre Saoirse Moen</author>
    &ch03;
  </novel>

The DTD in its entirety:

<!-- prose.dtd - ProseML fiction manuscript markup -->

<!ENTITY % versioninfo
           "version CDATA #IMPLIED	
            date CDATA #IMPLIED">
<!ENTITY % metainfo
           "(title,subtitle?,author+,address*,wordcount?,heading*)">
<!ENTITY % content
           "(par|secbreak|comment)*">

<!ELEMENT novel ( %metainfo; ,chapter*)>
<!ATTLIST novel %versioninfo;>

<!ELEMENT story (%metainfo;,%content;)>
<!ATTLIST story %versioninfo;>

<!ELEMENT chapter (title,subtitle?,%content;) >

<!ELEMENT title (#PCDATA)>
<!ELEMENT subtitle (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT wordcount (#PCDATA)>
<!ELEMENT heading (#PCDATA)>

<!ELEMENT par (#PCDATA|emph)*>
<!ATTLIST par indent CDATA "0">

<!ELEMENT secbreak (title?)>
<!ELEMENT comment (#PCDATA)>

<!ELEMENT emph (#PCDATA|emph)*>
<!ATTLIST emph style (italic|bold|underline|standard) "standard">

The error message when it's run:

$ /usr/local/bin/fop/fop.sh -xml novel-template.xml -xsl ~/Library/novel2ms.xsl -pdf test-novel.pdf
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] FOP 0.20.5
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[ERROR] The encoding declaration is required in the text declaration.


And, last, the XSL template:

<?xml version='1.0'?>

<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:fo='http://www.w3.org/1999/XSL/Format'>

<xsl:output method='xml'/>

<!-- Show comments in the prose as footnotes -->
<xsl:param name="comments" select="true()"/>

<xsl:template match="/">
  <fo:root font-family="Courier" font-size="12pt">
    <fo:layout-master-set>
      <fo:simple-page-master master-name="manuscript-title">
        <fo:region-body margin="1in"/>
      </fo:simple-page-master>
      <fo:simple-page-master master-name="manuscript-body">
        <fo:region-before extent="1.5in"/>
        <fo:region-body margin-left="1in" margin-right="1in"
        		 margin-top="1.5in" margin-bottom="1in"/>
      </fo:simple-page-master>
    </fo:layout-master-set>

<!-- Title page -->
<fo:page-sequence master-reference="manuscript-title" initial-page-number="0">
<fo:flow flow-name="xsl-region-body">
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-body>
<fo:table-row display-align="before">
<fo:table-cell>
<xsl:apply-templates select="novel/address"/>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="end">
<xsl:value-of select="novel/wordcount"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:block space-before="3in" font-weight="bold"
text-align="center">
<xsl:value-of select="novel/title"/>
</fo:block>
<fo:block text-align="center" space-before="12pt">by
<xsl:value-of select="novel/author"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
<xsl:apply-templates select="novel/chapter"/>
</fo:root>
</xsl:template>


<xsl:template match="address">
  <fo:block text-align="start">
    <xsl:value-of select="."/>
  </fo:block>
</xsl:template>

<xsl:template match="chapter">
<fo:page-sequence master-reference="manuscript-body">
<fo:static-content flow-name="xsl-region-before">
<fo:block text-align="right" space-before="1in" end-indent="1.5in">
<xsl:value-of select="/novel/heading"/> / <fo:page-number/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" line-height="2.1">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</xsl:template>


<xsl:template match="chapter/title">
<xsl:choose>
  <xsl:when test="../subtitle">
  <fo:block font-weight="bold" line-height="1"
            text-align="center" space-before="4in">
    <xsl:value-of select="../title"/>
  </fo:block>
  </xsl:when>
  <xsl:otherwise>
  <fo:block font-weight="bold" text-align="center" space-before="4in">
    <xsl:value-of select="."/>
  </fo:block>
  </xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="chapter/subtitle">
  <fo:block font-weight="bold" text-align="center">
    <xsl:value-of select="."/>
  </fo:block>
</xsl:template>

<xsl:template match="par">
  <fo:block text-indent="0.5in">
  <xsl:if test="number(@indent) &gt; 0">
    <xsl:attribute name="start-indent">
      <xsl:value-of select="concat(@indent*0.5,'in')"/>
    </xsl:attribute>
    <xsl:attribute name="end-indent">
      <xsl:value-of select="concat(@indent*0.5,'in')"/>
    </xsl:attribute>
  </xsl:if>
  <xsl:apply-templates/>
  </fo:block>
</xsl:template>

<xsl:template match="emph[@style='standard'] | emph[@style='underline']">
<fo:inline text-decoration="underline">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>


<xsl:template match="emph[@style='italic']">
  <fo:inline font-style="italic">
    <xsl:apply-templates/>
  </fo:inline>
</xsl:template>

<xsl:template match="emph[@style='bold']">
  <fo:inline font-weight="bold">
    <xsl:apply-templates/>
  </fo:inline>
</xsl:template>

<xsl:template match="secbreak">
  <fo:block text-align="center">#</fo:block>
</xsl:template>

<xsl:template match="comment">
  <xsl:if test="boolean($comments)">
  <fo:footnote>
    <fo:inline baseline-shift="super" font-size="smaller">
      (<xsl:number level="any"/>)
    </fo:inline>
    <fo:footnote-body>
      <fo:list-block provisional-label-separation="0pt"
              	     provisional-distance-between-starts="36pt"
                     space-after.optimum="6pt">
        <fo:list-item>
          <fo:list-item-label end-indent="label-end()">
            <fo:block>(<xsl:number level="any"/>) </fo:block>
          </fo:list-item-label>
          <fo:list-item-body start-indent="body-start()">
            <fo:block>
              <xsl:apply-templates/>
            </fo:block>
          </fo:list-item-body>
        </fo:list-item>
      </fo:list-block>
    </fo:footnote-body>
  </fo:footnote>
  </xsl:if>
  <!--<xsl:with-param name="fncount" select="$fncount + 1"/>-->
</xsl:template>

</xsl:stylesheet>

--
_Deirdre http://deirdre.net
"Cannot run out of time. There is infinite time. You are finite. Zathras is finite. This....is wrong tool." -- Zathras



Current Thread