Re: [xep-support] XSL validation - Easy answer - line 1: Incorrect top element - should be 'root'

From: Mike Ferrando <mikeferrando@yahoo.com>
Date: Tue Oct 26 2004 - 14:02:08 PDT

Frederic,

You are creating an XSL-FO document.

The XSL stylesheet needs to have templates to create the document.

The <fo:root/> cannot appear except in a template. (see below)

You need to look at some examples of this in action. Why not download
some xml and stylesheets?

http://www.antennahouse.com/XSLsample/XSLsample.htm

I would also suggest Dave Pawson's book XSL-FO. (www.amazon.com)

Sincerely,
Mike Ferrando
Library Technician
Music Division
Library of Congress
202-707-4454

<?xml version="1.0" encoding="UTF-8"?>
<book>
<titlepage>A really great book</titlepage>
<body>
<chapter>
<head>chapter 1</head>
<p>How by offending I make offense a skill, by redeeming time when
men think least I will.</p>
</chapter>
<chapter>
<head>chapter 2</head>
<p>No more shall this land daub her lips on her own children's blood,
<br/>No more shall trenching war channel her fields nor buise her
flowerets with the hostile paces of armoured hoves...</p>
</chapter>
</body>
</book>

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo="http://www.w3.org/1999/XSL/Format"
>

<xsl:strip-space elements="*"/>

<xsl:template match="/">
  <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- put your fo:layout-master-set templates here -->
    <xsl:apply-templates select="*"/>
  </fo:root>
</xsl:template>

<xsl:template match="titlepage">
  <fo:page-sequence
    master-reference="title-page"
    force-page-count="no-force"
>
<!-- flow elements in here -->
<!-- header static content -->
<!-- footer static content -->
    <fo:flow...>
      <xsl:apply-templates/>
    </fo:flow>
  </fo:page-sequence>
</xsl:template>

<xsl:template match="body">
  <fo:page-sequence
    master-reference="body-page"
    force-page-count="no-force"
>
<!-- flow elements in here -->
<!-- header static content -->
<!-- footer static content -->
    <fo:flow...>
      <xsl:apply-templates/>
    </fo:flow>
  </fo:page-sequence>
</xsl:template>

<xsl:template match="chapter">
<!-- check for the first chapter node -->
  <fo:block break-before="page">
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

<xsl:template match="head">
  <fo:block font-style="bold">
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

<xsl:template match="p">
  <fo:block space-before="0.1">
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

<xsl:template match="i">
  <fo:inline font-style="italic">
    <xsl:apply-templates/>
  </fo:inline>
</xsl:template>

</xsl:stylesheet>

--- frederic.ouellet@desjardins.com wrote:

>
>
>
>
>
> Hello group!
>
> I try a little test on my PDF generator on weblogic server.
>
> I want to generate an empty PDF document.(it is a feature ask for
> my generator, so I must test it to proof that's work...)
>
> So here is my xsl:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
> </fo:root>
> </xsl:stylesheet>
>
> The validation process give this error:
>
> (document
> (validate
> [error] line 1: Incorrect top element - should be 'root'
> [validation total: 1 error])
> (compile )
> (format )
> (generate [output-format pdf]))
>
> I have search google and I don't find any occurence for this error.
> :o(
>
> I have played with the XSL and the tag and after 2 hours, I give up
> and send it to you.
>
> What should I do with this top element?
>
> Best Regards,
> Frédéric Ouellet
>
>
> -------------------
> (*) To unsubscribe, send a message with words 'unsubscribe
> xep-support'
> in the body of the message to majordomo@renderx.com from the
> address
> you are subscribed from.
> (*) By using the Service, you expressly agree to these Terms of
> Service http://www.renderx.com/tos.html
>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html
Received on Tue Oct 26 14:56:46 2004

This archive was generated by hypermail 2.1.8 : Tue Oct 26 2004 - 14:56:47 PDT