Php Xml And Xsl ("master Page" & "details Page")

Good morning everyone.

I have an XML file name: specials.xml

<?xml version="1.0" encoding="UTF-8"?>
<specials>
    <menu_item id="1" course="app" status="live">
        <name>Summer Salad</name>
        <link>salad.html</link>
        <description>organic butter lettuce with apples, blood oranges, gorgonzola, and raspberry vinaigrette</description>
        <price>7</price>
    </menu_item>
    <menu_item id="2" course="app" status="live">
        <name>Thai Noodle Salad</name>
        <link>noodles.html</link>
        <description>lightly sauteed in sesame oil with baby bok choi, portobello mushrooms, and scallions</description>
        <price>6</price>
    </menu_item>
</specials>

The testmaster.php and testmaster.xsl pages (below) lists all products with status “live” and provides a link to the page testdetails.php that will show only the details of the item clicked.

testmaster.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>

   <?php $xml = new DOMDocument();
$xml->load( 'specials.xml' );

$xsl = new DOMDocument();
$xsl->load( 'testmaster.xsl' );

$xslt = new XSLTProcessor();
$xslt->importStylesheet( $xsl );
echo $xslt->transformToXML( $xml );
?>

</body>

</html>

testmaster.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output
                indent="yes"
                method="xml"
                omit-xml-declaration="yes" />
                
        <xsl:template match="/">
            
             <xsl:for-each select="specials/menu_item">
                <ul>      
                    <li>
                    <xsl:if test="@status = &apos;live&apos;">
                        <a>
                             <xsl:attribute name="href">
                               <xsl:text>testdetails.php?id=</xsl:text>
                               <xsl:value-of select="./@id" />
                             </xsl:attribute>
                            
                                 <xsl:value-of select="name"/>
                        </a>
                      </xsl:if>    
                    </li>    
                </ul>
            </xsl:for-each>
        </xsl:template>
</xsl:stylesheet>

Below are the pages (I’m trying to build) responsible for showing the details of the clicked item, testdetails.php and testdetails.xsl.

testdetails.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>

<body>

<?php
  $id = $_GET['id'];
echo $id;
?>
  
   <?php
$xml = new DOMDocument;

$reader = new XMLReader();
$reader->open( 'specials.xml' );
while( $reader->next( 'menu_item') ) {
    if ($reader->getAttribute( 'id' ) === $id) {
        $xml->appendChild($xml->importNode($reader->expand(), true));
        break;
    }
}

if (!$xml->documentElement instanceof DOMElement) {
//There is no menu_item with this ID. You can perform error handling and/or create an error document here
}

$xsl = new DOMDocument();
$xsl->load( 'testdetails.xsl' );

$xslt = new XSLTProcessor();
$xslt->importStylesheet( $xsl );
echo $xslt->transformToXML( $xml );
?>
</body>

</html>

and testdetails.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output
                indent="yes"
                method="xml"
                omit-xml-declaration="yes" />
                
        <xsl:template match="/menu_item">
                              
                Categoria:<xsl:value-of select="@course"/>
                <br />
                <br />
                Codigo: <xsl:value-of select="@id"/><br />
                <br />
                Nome: <xsl:value-of select="name"/><br />
                <br />
                Descricao: <xsl:value-of select="description"/><br />
                <br />
                Price: £<xsl:value-of select="price"/>
                                      
        </xsl:template>
</xsl:stylesheet>

But the page testedetails.php loads empty.

Someone to help me please!!!

thanks