xsl-list
[Top] [All Lists]

I'm obviously doing something wrong

2005-04-27 12:32:12
I've stared at it and fiddled with it, and another person's looked at it
and can't figure it out either.

I'm getting the dreaded "Root element must be root, not Topics," but I
can't quite grok why (yes, I've looked at every example Google came up
with; the reasons given either didn't seem to apply or weren't helpful).
In general, the explanations given were so terse that I'd only understand
them if I already understood what I did wrong, thus creating a bootstrap
issue for people trying to learn.

Naturally, I cobbled parts of this together from working stylesheets.

In case it is an issue, I'm using the toolchain embedded in oXygen 5.1.

Can someone point out what I'm doing wrong?

XML:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="mTopicsPanels.xsl"?>
<!DOCTYPE
Topics [

<!ELEMENT Topics ANY>
<!ELEMENT Topic ANY>
<!ELEMENT Panel ANY>

]>
<Topics>
        <Topic>A</Topic>
                <Panel>First</Panel>
                <Panel>Second</Panel>
                <Panel>Third</Panel>
                <Panel>Fourth</Panel>
        <Topic>B</Topic>
                <Panel>First</Panel>
                <Panel>Second</Panel>
                <Panel>Third</Panel>
                <Panel>Fourth</Panel>
</Topics>

XSL:

<?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'
        xmlns:fox='http://xml.apache.org/fop/extensions'
        xmlns:date='java.util.Date'
        xmlns:format='java.text.SimpleDateFormat'
exclude-result-prefixes='date'>

<xsl:output method='xml'/>

<xsl:template match="/">
  <fo:root font-family="Helvetica" font-size="12pt"
xmlns:fo="http://www.w3.org/XSL/Format/1.0";>
    <fo:layout-master-set>

      <fo:simple-page-master master-name="contents">
        <fo:region-body margin-left="2in" margin-right="1in"
                         margin-top="1in" margin-bottom="1.5in"/>
        <fo:region-after extent="1in"/>
     </fo:simple-page-master>
    </fo:layout-master-set>

<!-- image the pages -->

        <fo:page-sequence master-reference="contents"
initial-page-number="1">
    <fo:static-content flow-name="xsl-region-after">
        <fo:block text-align="left" space-after="0.75in" font-size="8pt">
                <fo:page-number/>
        </fo:block>
      <fo:block text-align="right" space-after="0.75in" end-indent="1.0in"
font-size="8pt">
                        <xsl:variable
name="pattern">yyyy-MM-dd</xsl:variable>
                        <xsl:variable name="SimpleDateFormat"
select="format:new($pattern)"/>
                        <xsl:variable name="Date" select="date:new()"/>
                        As of: <xsl:value-of
select="format:format($SimpleDateFormat, $Date)"/>
      </fo:block>
    </fo:static-content>

          <fo:flow flow-name="xsl-region-body">
            <xsl:apply-templates />
          </fo:flow>
        </fo:page-sequence>
  </fo:root>
</xsl:template>

 <xsl:template match="Topic">
    <fo:block font-weight="bold" text-align="center" space-before="12pt">
        <xsl:value-of select="."/>
    </fo:block>
    <xsl:apply-templates select="Panel"/>
</xsl:template>

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

</xsl:stylesheet>


-- 
_Deirdre  web: http://deirdre.net        blog: http://deirdre.org/blog/
yarn: http://fuzzyorange.com    cat's blog: http://fuzzyorange.com/vsd/
"Memes are a hoax! Pass it on!"


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>