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

Re: Subsection Formatting

Subject: Re: Subsection Formatting
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Fri, 28 Jun 2002 08:53:59 +0200
subsection css
<xsl:template match="SubSection">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="ssHdr">
  <h3><xsl:apply-templates/></h3>
</xsl:template>

<xsl:template match="TextPara">
  <p><xsl:apply-templates/></p>
</xsl:template>

<xsl:template match="Introduction">
  <html>
    <head>
      <title>
        <xsl:apply-templates select="IntroTitle"/>
      </title>
      <link rel="stylesheet" href="novabasic.css" type="text/css"/>
    </head>
    <body>
      <h2 align="center"><xsl:apply-templates select="IntroTitle"/></h2>
      <xsl:apply-templates select="ProbStmt"/>
      <!-- where does ssHdr come from? there is no ssHdr in DTD -->
      <h3><xsl:value-of select="ssHdr"/></h3>
    </body>
  </html>
</xsl:template>

For a more or less arbitrary XML code, it's mostly better to use <xsl:apply-templates/> instead of <xsl:value-of/>. Your problem was the <xsl:value-of select="ProbStmt"/>, which returns a concatenated string of all the descendant text nodes in <ProbStmt/>.

Regards,

Joerg


Jack Cane wrote:
I'm quite new at xml/xslt. Have created a dtd and style sheet which work, to
a point. The problem is with separation and formatting of subsection
elements. At present the subsection title and all text paragraphs are in one
paragraph.

Would appreciate some feedback on where I am going wrong here.

========================================

Here is the xsl content:

<?xml version = "1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="dissertation.dtd"
                xmlns:html="http://www.w3.org/1999/xhtml"
                version="1.0">
	<xsl:template match="SubSection">
		<h3><xsl:value-of select="ssHdr"/></h3>
		<p><xsl:value-of select="TextPara"/></p>
	</xsl:template>
  <xsl:template match="Introduction">
    <html>
      <head>
        <title>
          <xsl:value-of select="IntroTitle"/>
        </title>
        <link rel="stylesheet" href="novabasic.css" type="text/css"/>
      </head>
      <body>
        <h2 align="center"><xsl:value-of select="IntroTitle"/></h2>
        <xsl:value-of select="ProbStmt"/>
        <h3><xsl:value-of select="ssHdr"/></h3>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

========================================

And here is the relevant part of the dtd:

  <!ELEMENT SubSection (ssHdr, TextPara+)>
    <!ELEMENT ssHdr (#PCDATA)>
    <!ELEMENT TextPara (#PCDATA)>

  <!ELEMENT Section (SectHdr, SubSection+)>
    <!ELEMENT SectHdr (#PCDATA)>
    <!ELEMENT SubSect (SubSection)>

  <!ELEMENT Chapter (ChapHdg, Section+)>
    <!ELEMENT ChapHdg (#PCDATA)>
    <!ELEMENT Sect (Section)>

<!ELEMENT Introduction (IntroTitle, ProbStmt)>

    <!ELEMENT IntroTitle (SectHdr)>
    <!ELEMENT ProbStmt (SubSection)>

========================================

tks,

jwc


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


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.