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

Using XSLT to create an XHTML document

Subject: Using XSLT to create an XHTML document
From: Christiane Faucher <christiane@xxxxxxxxxxx>
Date: Thu, 3 Jun 1999 16:00:08 -0400
xslt generate xhtml
Title: Using XSLT to create an XHTML document

I am new in the XSLT world...    I have read that an XSL style sheet can be used to generate XHTML.  My question is the following:  Do we need a specialized XSL formatting engine to render the result generated by the XSLT (to output it on the screen)?  I know that it should produce an XHTML file viewable on a browser but... How come I do not see that newly generated XHTML file when I apply the stylesheet to the data document?  What steps am I missing? (Obviously I am missing some!)

Any idea/suggestion/correction are more than welcome...
Thanks
Christiane


This is an example of using XSLT to create an XHTML document.  The following stylesheet (XHTMLTranformation.xsl):
<?xml version="1.0"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
  xmlns="http://www.w3.org/Profiles/xhtml1-transitional"
  default-space="strip"
  indent-result="yes">
        <xsl:template match="/">
<html>
        <head>
                <title>Sales Results By Division</title>
        </head>
        <body>
                <table border="1">
                <tr>
                        <th>Division</th>
                        <th>Revenue</th>
                        <th>Growth</th>
                        <th>Bonus</th>
                </tr>
        <xsl:apply-templates/>
                </table>
        </body>
</html>
        </xsl:template>

        <xsl:template match="sales">
                <xsl:apply-templates match="division">
                        <!-- order the result by revenue -->
                        <xsl:sort select="revenue"
                                  data-type="number"
                                  order="descending"/>
                </xsl:apply-templates>
        </xsl:template>

        <xsl:template match="division">
                        <tr>
                        <td><em><xsl:value-of select="@id"/></em></td>
                <xsl:apply-templates select="revenue"/>
                <xsl:apply-templates select="growth"/>
                <xsl:apply-templates select="bonus"/>
                        </tr>

        </xsl:template>

        <xsl:template match="revenue | growth | bonus">
                        <td><xsl:apply-templates/></td>
        </xsl:template>
</xsl:stylesheet>

---- with the following input document:

<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="">

<sales>

        <division id="North">
                <revenue>10</revenue>
                <growth>9</growth>
                <bonus>7</bonus>
        </division>

        <division id="South">
                <revenue>4</revenue>
                <growth>3</growth>
                <bonus>4</bonus>
        </division>

        <division id="West">
                <revenue>6</revenue>
                <growth>-1.5</growth>
                <bonus>2</bonus>
        </division>

</sales>


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.