|
next
|
 Subject: Applying more than one XSLT on the same XML Author: Mehran Ziadloo Date: 04 Nov 2005 08:32 AM
|
The fact is I'm trying to create a PHP Web Application Framework for my company. And right now I'm researching to understand how can I use XML to present the framework's front-end.
I want my code to create an XML output, based on the user input and other stuff and then use XSLT to render it. My problem is, since I would like to have as the most consistency as possible, I want to create stand-alone packages. Somehow that if I had to reuse a package, it requires the lowest possible effort.
As the conclusion, I need each package to have its own XSLT files. But these XSLT files are not about to create a complete HTML file becuase they are created to present a part of a page, not all of it, perhaps like a TABLE tag. And then with combining package's XML with other information, which they have XML structure too, I'll have an XML containing all the necessary information. But this XML requires different XSLT files to render correctly.
I know it's getting too long, but perhaps a practical example fixes everything:
Consider the user management package, there's a page to show the list of all users. Also there will be a page to show a single user info. I would like to design two XSLT files just to render the user list and user's info, I name them UserList.xsl and UserInfo.xsl, but their output's root tag will be a TABLE tag not HTML tag. I need an extra XSLT file to add the complemental tags, like HTML, lets name it PageDesign.xsl. Now think of the time you're about to see the list of users. There will be three files engaged, two of them we have already created, UserList.xsl and PageDesign.xsl. The third one, we have to create on-the-fly since its content depends on user input, and it's an XML file containing the actual information of user list.
But the time we are about to see the user info page, there will be a different set of pages engaged. UserInfo.xsl, PageDesign.xsl and on-the-fly created XML file of user info.
If you're reading this part of my letter, then you must be bored by now. That's all I'm asking, so can you please help me and give a clue how it's possible? One XML file and two XSLT files!!
Thanks alot for your patience,
Mehran Ziadloo
|
|
|
|