[plug] [OT] XSTL .vs. PHP .vs. ???

Tim White weirdo at tigris.org
Thu Jun 3 16:18:02 WST 2004


I am currently making a mock up interactive zoo. I am trying to work out 
the best way to handle the animal data although I want to store it in 
XML. The server I am using only has Apache and PHP (4 i think) and no 
database access. I am also hoping to be able to produce the IZoo in such 
a way that it can be put onto a CD-ROM and used for offline browsing.
I know that with XSLT I can use javascript to do this offline.
All that I need to work out is it better to use XSLT or PHP which loads 
the animal data in to variables and just outputs the file with the 
blanks filled in.
The dynamic data includes headers, 'related links' menus, and a main 
exhibit containing articles. I am thinking that XSLT would be the best 
as it would make it easy to have as many storys and articles in the main 
exhibit with a simple xsl:for-each tag. I know that this is also 
possible in PHP.
I am trying to work out how to do the main part of the XSL parsing. In 
the page HTML the order of data appears is;
- Header with meta data (Static except for Title)
- Main Menu Links (Generated from XML or static (unknown at moment))
- Exhibit:
    * Header (Dynamic)
    * Main Article (Dynamic)
    * Sub Articles (Dynamic)
- Related Links (Dynamic)
- Exhibit Media Items (Dynamic)
The Order the data appears in the XML is:
<animal>
    <name/>
    <header stuff/>
    <articles>
       <main/>
       <sub story/>
       <sub story/>
        ...
    </articles>
    <related links/>
    <media items/>
</animal>

I am not sure how to do this as it requires reordering and it is some 
time since I have programmed XSL. If anybody can help me and convince me 
that XSL is the way then please do.
The other main problem I have is whether I use a separate XML file for 
each animal and have the PHP parse a different file each time or I have 
one big file and parse that with an xsl:if. If that is the recommended 
way then how do I 1. Set a variable so that only that animals part of 
the tree is parsed and 2. how do i use that variable in an xsl:if.

Thanks
Tim




More information about the plug mailing list