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

Re: Rescuing XSLT from Niche Status

Subject: Re: Rescuing XSLT from Niche Status
From: "Steve Muench" <Steve.Muench@xxxxxxxxxx>
Date: Fri, 16 Feb 2001 13:19:08 -0800
rescuing xslt from niche status
| 
| http://www.xfront.com/rescuing-xslt.html
|

Roger, David,

One of the features that the XSLT 1.0 spec provides
to cater to the first-time-HTML-savvy user, is the
verbosely-named "literal-result element as stylesheet"
capability. Stylesheets that use this capability
are often called "single-root-template" stylesheets
or stylesheets written in the "simple form".

Use of this could further improve on David's smooth-slope
introduction to XSLT for first-time users. It's a technique
that I use for simple HTML and XML transformations in my
"Building Oracle XML Applications" book.

That is, instead of writing:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
  <xsl:template match="/">
    <HTML>
      <HEAD>
        <TITLE>Welcome</TITLE>
      </HEAD>
      <BODY>
        <FONT bgcolor="{member/favoriteColor}">
          Welcome <xsl:value-of select="member/name"/>!
        </FONT>
        <TABLE>
          <TR><TH>Type</TH><TH>Number</TH></TR>
          <xsl:for-each select="member/phone">
            <TR>
              <TD><xsl:value-of select="@type"/></TD>
              <TD><xsl:value-of select="."/></TD>
            </TR>
          </xsl:for-each>
        </TABLE>
      </BODY>
  </HTML>
</xsl:template>
</xsl:stylesheet>

You can write:

<HTML xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <HEAD>
    <TITLE>Welcome</TITLE>
  </HEAD>
  <BODY>
    <FONT bgcolor="{member/favoriteColor}">
      Welcome <xsl:value-of select="member/name"/>!
    </FONT>
    <TABLE>
      <TR><TH>Type</TH><TH>Number</TH></TR>
      <xsl:for-each select="member/phone">
        <TR>
          <TD><xsl:value-of select="@type"/></TD>
          <TD><xsl:value-of select="."/></TD>
        </TR>
      </xsl:for-each>
    </TABLE>
  </BODY>
</HTML>

And you can teach people that the steps to
get started are to:

  (1) Get an HTML template from your web design folks
  (2) Use Dave Raggett's "tidy" with the "-asxml" option
      to convert the HTML to well-formed HTML
  (3) Add an "xsl:version" to the <HTML> root element
  (4) Begin "peppering" in <xsl:value-of>, attribute value
      templates, and <xsl:for-each>'s to suit.

______________________________________________________________
Steve Muench, Lead XML Evangelist & Consulting Product Manager
BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
Author "Building Oracle XML Applications", O'Reilly
http://www.oreilly.com/catalog/orxmlapp/



 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.