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

Re: XSLT 1: From flat XML to tree hierarchy XML. Can't

Subject: Re: XSLT 1: From flat XML to tree hierarchy XML. Can't seem to find the right way to do it.
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 25 May 2006 18:50:19 -0400
xslt flat xml
At 06:31 PM 5/25/2006, you wrote:
I'd be curious if people on this list
have opinions on whether or not they've come up with rules for when to
use literal result elements and when to use xsl:element.

My $0.02:


Use literal result elements when you can; use xsl:element when you have to.

You have to use xsl:element when:
 * The element name is being generated dynamically
 * You are developing in a framework that doesn't like LREs
   (maybe it's validating the stylesheet against a schema
    with only the xsl elements in it)
 * You are doing something funky involving names and/or namespaces,
   such as stripping namespaces.

... and there may be one or two other reasons.

I find LREs much easier to read and maintain. LREs do have a pedagogical downside, as beginners sometimes interpret them as meaning the processor does "tag writing" (which it doesn't). But the real fix for that is not to avoid them, but simply present a good demonstration of how tag-writing isn't what's happening (for example, showing output of empty HTML elements with output method="xml" vs method="html").

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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