You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Shawn Bedard <ju...@jig.to> on 2002/04/07 18:28:59 UTC

XSL - Unknown formatting object error

I have a newbie question concerning the XSL parsing in FOP.  I think I have
everything set up correctly because all the test work fine.  However, I have
a
series of really simple xsl files that parse with other tools.  But, the FOP
application (more precisely xalan) can't seem to parse anything?!?  I'm not
sure what I'm doing wrong.  I'm running the command "fop -xml hello.xml -xsl
hello.xsl -pdf hello.pdf" and get a  Unknown formatting object error:

[INFO]: FOP 0.20.3
[INFO]: building formatting object tree
[ERROR]: Unknown formatting object ^html
javax.xml.transform.TransformerException
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
ava:1212)
        at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
        at java.lang.Thread.run(Thread.java:484)
---------
java.lang.NullPointerException
        at
org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:276)
        at
org.apache.xalan.transformer.QueuedStartElement.flush(QueuedStartElement.jav
a:286)
        at
org.apache.xalan.transformer.ResultTreeHandler.flushPending(ResultTreeHandle
r.java:774)
        at
org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.
java:283)
        at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:
749)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
erImpl.java:2154)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
erImpl.java:2097)
        at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Transformer
Impl.java:2029)
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
ava:1189)
        at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
        at java.lang.Thread.run(Thread.java:484)
[ERROR]: null

I don't see why as the xslt file is dead simple:
hello.xsl:
  <?xml version="1.0"?>
  <html xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xsl:version="1.0">
   <head><title>Greeting</title></head>
   <body><p>Words of greeting:<br/>
     <b><i><u><xsl:value-of select="greeting"/></u></i></b>
     </p></body>
  </html>


The xml file is even simpler:
  <?xml version="1.0"?>
  <?xml-stylesheet type="text/xsl" href="hello.xsl"?>
  <greeting>Hello world.</greeting>


What am I doing wrong?   Is there some special xslt standard that I don't
know about. Even if someone could provide me with some references and
links concerning xslt sample for FOP that would be great.  The current
doc is somewhat lacking in this area.

I took a look at http://www.owal.co.uk:8090/asf/servlet/asf/ and there seems
to be nothing there.  So I apologize if this is a newbie question.

Thanks,
	Shawn


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: XSL - Unknown formatting object error

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Shawn Bedard wrote:
> I have a newbie question concerning the XSL parsing in FOP.  I think I have
> everything set up correctly because all the test work fine.  However, I have
> a
> series of really simple xsl files that parse with other tools.

First, get your nomenclature straight. An XSL file is an XML
document, which is parsed by an XML parser. The XSLT processor
stores/compiles this into something which will be used to
control a transformation. This transformation is applied
to an input tree, generated by an XML parser from an input XML
document, and produces a result tree, which could be serialized
into a result document.
FOP is something different from an XSLT processor (or an XML
parser) FOP uses and XML source with som special vocabulary,
XSLFO, and produces a rendered version in a Java widget or in
some other file format, like PDF.
It is common to produce the input for FOP, XSLFO, by an XSL
transformation. The FOP command line application allows you
either to supply an input FO and some output format, or you
can supply an input XML, an XSLT file which describes the
transformation from the input XML vocabulary into FOs, and
some output format description as in the first case. Xalan
is an XSLT processor which is used by default by FOP to execute
the transformation in the second case.


> [ERROR]: Unknown formatting object ^html
This means you are not generating the FO vocabulary FOP
expects, but HTML instead.

> What am I doing wrong?
The input for FOP, XSLFO files, is a quite different beast
the HTML.
Try the following XSL file, it will generate a very simple
XSLFO from your XML file:

  <?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:template match="/">
      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
        <fo:layout-master-set>
          <fo:simple-page-master master-name="simple"
            page-height="29.7cm"
            page-width="21cm">
            <fo:region-body/>
          </fo:simple-page-master>
        </fo:layout-master-set>
        <fo:page-sequence master-reference="simple">
          <fo:flow flow-name="xsl-region-body">
            <fo:block font-size="24pt" text-align="center">Greeting</fo:block>
            <fo:block>Words of greeting:</fo:block>
            <fo:block font-weight="bold" font-style="italic" text-decoration="underline">
              <xsl:value-of select="greeting"/>
            </fo:block>
          </fo:flow>
        </fo:page-sequence>
      </fo:root>
    </xsl:template>
  </xsl:stylesheet>

> Is there some special xslt standard that I don't
> know about.
Not XSLT, but XSL :-)

> Even if someone could provide me with some references and
> links concerning xslt sample for FOP that would be great.

You have to differentiate between XSLT, which governs transformations,
and XSLFO, which describes layout/formatting. You use XSLT to transform
your input XML into various other stuff, for example HTML or XSLFO.
You have to use different XSLT templates for different output.

HTH
J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org