OT? - newbie php/xml/xsl question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I know this is off-topic, but I'm hoping someone will share a little
php/xml/xsl knowledge with me.

I'm trying to (via php 5) to do the following:

 - load an xml file
 - load an xsl stylesheet
 - apply the two, and build a page that contains hyperlinks based on the xml

Here's the basics of the xml layout, test.xml 

<?xml version="1.0" encoding="iso-8859-1"?>
<dataset>
<record>
<menu_name>Content Manager</menu_name>
<menu_description>This section of your site management system allows 
you add/edit/delete pages in your site, add photos, etc.
</menu_description>
<url_label>Click here to go to the Content Manager</url_label>
<menu_url>pages/index.php"</menu_url>
</record>
<record>
<menu_name>Site Configuration</menu_name>
<menu_description>Choose your site template, choose/upload your 
logo, and manage other website related information.</menu_description>
<url_label>Click here to go to Site Configuration.</url_label>
<menu_url>config</menu_url>
</record>
</dataset>

I'm trying to output an html table that would have for each row:

<tr>
<td>(value of menu_name)</td>
<td>(value of menu_description</td>
<td><a href="(value of menu_url)">(value of url_label)</a></td>
</tr>

I'm getting hung up on the xsl side of things.  How would you create the link
portion via xsl?  My php page that calls all of this looks like:

<?
$xml = simplexml_load_file('test.xml');
$xsl = simpleXML_load_file('test.xsl');
$proc = new XsltProcessor();
$proc->importStylesheet($xsl);
$newxml = $proc->transformToDoc($xml);
print $newxml->saveXML();
?>

I'd like to get this to work with php putting the pieces together, and have
xsl handle the xml transformation, but can't figure out the xsl necessary to
construct the href.

Anyone know how to do this?

Thanks in advance, and sorry for the off-topic post.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux