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

Re: How do I create a XSLT referencing DTD's with ?,+,

Subject: Re: How do I create a XSLT referencing DTD's with ?,+,*
From: Stephane Bortzmeyer <bortzmeyer@xxxxxx>
Date: Mon, 28 Apr 2003 10:02:04 +0200
create xsl from dtd
On Sat, Apr 26, 2003 at 10:17:48AM -0700,
 K. D. <mail2dennis2@xxxxxxxxx> wrote 
 a message of 32 lines which said:

> Thank you in advance for your help.  I am very
> confused on how to build a XSLT stylesheet that
> converts a document validated by a DTD with ?,+, and
> *'s (like the enclosed example) from XML format to
> publishable HTML.  

It seems that (correct me if I'm wrong) you are a complete beginner in
XSLT. If so, I suggest that you cannot write your first stylesheet in
the next minutes and you should start to read a good book about XSLT.

For the DTD you mention, you will have to write a set of templates,
each generating HTML. For instance (I do not list every template and
this stylesheet is a fast and very crude one):

<?xml version="1.0" encoding="us-ascii"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
  
  <xsl:output method="xml"
    doctype-system="http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd" 
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    indent="yes"/>
  
  <xsl:template match="/REPORT">
    <html>
      <head>
	<title><xsl:value-of select="TITLE"/></title>
      </head>
      <body>
	<xsl:apply-templates/>
      </body>
    </html>
  </xsl:template>
  
  <xsl:template match="SECTION">
    <!-- TODO: sections can be nested -->
    <h1><xsl:value-of select="TITLE"/></h1>
    <xsl:apply-templates/>
  </xsl:template>
  
  <xsl:template match="PARA">
    <p><xsl:apply-templates/></p>
  </xsl:template>
  
  </xsl:stylesheet>



 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.