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

Stumped on why a field isn't showing up

Subject: Stumped on why a field isn't showing up
From: Deirdre Saoirse Moen <deirdre@xxxxxxxxxxx>
Date: Sun, 13 Jun 2004 04:18:20 -0700
my template isnt showing
I'm trying to learn XSL(-FO), so I'm still beating my head against the wall.

I've managed to get everything except, oh, the most important piece of information to render correctly.

What I don't understand (and I've tried several approaches including putting it in several places) why the name and address fields *don't* render. Code is below. Output can be seen at http://deirdre.org/df-synopsis-1.pdf

Here's my understanding of what it's doing:

1) the page master is telling it to render novel/chapter
2) chapter is rendering the heading, omitting the name and address in the body
3) it then renders the rest of the tags, including the chapter heading (in this case, synopsis) and the chapter body.


Incoming XML file:
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE novel SYSTEM 'prose.dtd'
  [
     <!ENTITY ch01 SYSTEM "df-synopsis-1.xml">
  ] >
  <novel>
    <title>Deep Fried</title>
    <author>Deirdre Saoirse Moen</author>
    <address>2033 Sharon Road</address>
    <address>Menlo Park, CA 94025</address>
    <address>650-561-9820 (H)</address>
    <address>650-283-6636 (M)</address>
    <address>deirdre@xxxxxxxxxxx</address>
    <wordcount>Approx. 100,000 words</wordcount>
    <heading>Saoirse Moen / Synopsis: Deep Fried</heading>
    &ch01;
  </novel>


XSL 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:output method='xml'/>

<!-- Show comments in the prose as footnotes -->
<xsl:template match="/">
  <fo:root font-family="Courier" font-size="12pt">
    <fo:layout-master-set>
      <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>
    <xsl:apply-templates select="novel/chapter"/>
  </fo:root>
</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="1.5">
<xsl:apply-templates select="novel/author"/>
<xsl:apply-templates select="novel/address"/>
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</xsl:template>




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

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

<xsl:template match="chapter/title">
<xsl:choose>
  <xsl:when test="../subtitle">
  <fo:block font-weight="bold" text-align="center" space-after="0.25in">
    <xsl:value-of select="../title"/>
  </fo:block>
  </xsl:when>
  <xsl:otherwise>
  <fo:block font-weight="bold" text-align="center" space-after="0.25in">
    <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"
                                                   space-after="0.25in">
    <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: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

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

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-2013 All Rights Reserved.