[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

I'm obviously doing something wrong

Subject: I'm obviously doing something wrong
From: Deirdre Saoirse Moen <deirdre@xxxxxxxxxxx>
Date: Wed, 27 Apr 2005 12:32:12 -0700 (PDT)
java simpledateformat
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!"

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.