xsl-list
[Top] [All Lists]

RE: Which is more efficient?

2003-03-10 13:49:27
From: Caron, Daniel [mailto:DCaron(_at_)massmutual(_dot_)com]
Sent: Monday, March 10, 2003 1:14 PM
Subject: [xsl] Which is more efficient?


Which of these is the most efficient way of rendering html?  
It's obvious
which one is easier to code, but which one would actually parse more
quickly?  In the abbreviated examples below, the difference, 
of course would
be negligible...but consider a page of a few thousand lines 
of rendered
HTML.

Neither of your code snippets would actually render HTML.  In XSLT 1.0, in
the absence of an explicit xsl:output element, the default output is XML.
So your result is actually XML with elements that happen to look like HTML
markup.

As to your question: I can't answer with empirical data, and every XSLT
processor opitmizes things differently.  But given that XSLT processors
simply copy literal result elements directly to the result tree, your first
stylesheet (without any elements outside the default namespace) would seem
to be quicker.  xsl:element and xsl:attribute are obviously very cumbersome
to write, but you'll want to use them when you need to control the output of
element names and attributes at run-time.

cheers,
b.

| brian martinez                              
brian(_dot_)martinez(_at_)trip(_dot_)com |
| lead gui programmer                                    303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

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



<Prev in Thread] Current Thread [Next in Thread>