XSLT vs DOM

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamesm6162
    New Member
    • Mar 2007
    • 16

    XSLT vs DOM

    I want to insert some formatted XML data into my webpage using php.

    My question is which option would be the best choice in terms of performance:

    1.) Using the php DOM functions and iterating over the structure mannually

    2.) Or using the XSLTProcessor class and simply creating an XSLT stylesheet to use with it. (3 lines of php code)

    Note: I do not need to write to the data, only read from it.
  • Gulzor
    New Member
    • Jul 2008
    • 27

    #2
    Personaly :

    I would first have a look at the complexity of the xml structure. If it's too simple, I would loop into it with just the dom api and I generate the html "by hand".

    If it is not (like 2 or more depth levels), I go DOM+XSLT without hesitation.

    In both cases I try to save the result (the outputted html) into a file in order to avoid unecessary processing.

    Comment

    Working...