Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML + XSL + PHP + Dynamic Content...

Status
Not open for further replies.

tinnerdxp

Programmer
Feb 16, 2005
2
GB
Dear All,
Probably a quick question but I might be missing something major here.
I got PHP OO script that generates portal content as XML.
the content changes from page to page. so the first page looks like this:
<NEWSSECTION>
<NEWS>
<ID>1</ID>
<AUTHOR>whoever</AUTHOR>
</NEWS>
</NEWSSECTION>

<MAINSECTION>
...
</MAINSECTION>

<REST>
..
</REST>

but the news subpage will not have the <MAINSECTION> or the <REST> parts in it...

To simplify things my PHP generates complete XML objects for relevant parts of the website and I would like to use XSL to actually control that on the first page it should display only headers and let's say 50 characters of each.
Then on the news page XSL should display the whole news content... To make things even more complicated the website will be available for mobile devices eventually therefore the XSL file for mobile phones will be different from the one used for the normal browser.
Ideally I should generate XSL file on the fly and include it in the same XML file but I have problems with it...

1. What the parser parses first? Is it XML or XSL? or in other words - shall I include the XSL in the XML file and serve it to the browser or shall I include the XML content in XSL file?

2. How do I include these two in the same file? I have read but I don't understand how to properly define DTD in the file so it would work. Does DTD has to define ALL the items in the XML or can in define only the root <doc> element with the ID tag in it so the rest of XML could change dynamically?

3. Have I choosen well with involving XML here? I could easily prepare PHP subclasses giving me the HTML content formatted for browsers/mobiles/etc... but I wanted to create the content as versatile as possible so when my boss will tell me - I want this content to be shared with xyz - I can just dump the XML to him and/or change XSL for his IP...

4. I can prepare separate XSL files for each individual page including templates for all possible tags but surely this is not the way to go...

5. Am I missing something here? Maybe there is some other magic XML-XYZ technology that suits my case better?

Thank you for your replies.
tinner
 
Thanks Tsuji,
It did indeed cleared some sky for me.
I appreciate your input.
kind regards
tinner
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top