This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: DOM and XML parser


Hi,

Ashu said:
So what i understood is that when after converting html into well 
formed xml(xhtml) i call the function (i am using php as it 
support only sablotron processor)
xslt_process($ch , htmlfile.html ,stylesheet.xsl);
then  expat makes a dom like structure of xhtml on which the 
stylesheet applied.

Didier replies:
Yes XLST engines create a tree of elements, attributes and data at least
at the conceptual level. In reality, for efficiency purposes, they may
create more efficient structures. Do not forget that the DOM is simply a
set of interfaces but not the structure itself.  Having said that, it is
OK to think of the structure produced by the parsing mechanism as a
tree. The XSLT engine uses that in-memory tree to match the templates
and create the output.

As a rule of thumb and from a practical standpoint, uses XSLT when you
want to produce a text document as output. If however, for efficiency
reasons or any other one you find that XSLT processing is not what you
want because:
a) the produced structure is taking too much room
b) you do not like XSLT (or do not want to learn it)
c) The processor is too slow
d) any other reason :-)
then you use sax. This basically implies that you create your own XML
document interpreter implemented in the language of your choice. 

Think of XSLT as an XML document type interpreter. XSLT is a domain
language used  to perform transformation on XML documents with the main
characteristics that its syntax is based XML document's structural
rules. However, you are not limited to this sole language to process XML
document. In other words you can implement you own XML document
interpreter with another language like C, C++, Python, PERL, Java,
etc... for which an XML parser is available. Having the capacity to
create your own interpretation rules then you are not obliged to create
a complete in-memory structure but instead your interpreter can process
only the entities (elements, attributes, etc..) that you want to be
processed. Also, since you can implement your own interpreter more
efficiently, then you can:
a) reduce the memory footprint
b) increase the processing speed.
c) create new processing paradigms
d) create your own interpretation language (for instance something like
Omnimark or DSSSL)

So I do not know if the book you refer to is the first or the second
edition (I wrote some chapters in the first edition but not chapter 6
:-) but as an author of this book I felt responsible to help you. 

Cheers
Didier PH Martin




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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]