Hi I wonder if anyone can help. I have developed an XML file of the structure of my website

Code:
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
	<head>
		<title>Sitemap.opml</title>
		<dateCreated>Tues, 4 Nov 2008 16:00:00 GMT</dateCreated>
		<dateModified>Tues, 4 Nov 2008 16:00:00 GMT</dateModified>
		<ownerName>Steven Price</ownerName>
		<ownerEmail>test@test.com</ownerEmail>
	</head>
	<body>
		<outline text="gallery 1" page="gallery" type="link" rel_url="gallery1.php" url="gallery1.php">		
		    <outline text="content page 1" page="content" type="link" rel_url="content-page1.php" url="content-page1.php">test1</outline>
			<outline text="content page 2" page="content" type="link" rel_url="content-page2.php" url="content-page2.php">test2</outline>
			<outline text="content page 3" page="content" type="link" rel_url="content-page3.php" url="content-page3.php">test3		
		    </outline>
		
		</outline>	
		
		
		<outline text="gallery 2" page="gallery" type="link" rel_url="gallery2.php" url="gallery2.php">		
		    <outline text="content page 4" page="content" type="link" rel_url="content-page4.php" url="content-page4.php">test4</outline>
			<outline text="content page 5" page="content" type="link" rel_url="content-page5.php" url="content-page4.php">test5</outline>
			<outline text="content page 6" page="content" type="link" rel_url="content-page6.php" url="content-page6.php">test6			
		    </outline>
		</outline>
		
		
	</body>
</opml>
I want to show only those pages belonging to their gallery section (e.g. page 1, 2, 3 or page 4, 5, 6). So I developed this XSL file


Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">




<xsl:template match="/opml">  
  
   <xsl:apply-templates select="body" />   
</xsl:template>


<xsl:template match="body">  
   <xsl:apply-templates select="outline/outline" />    
</xsl:template>


<xsl:template match="outline">  

  
  
  <xsl:if test="@rel_url='$this_page'">         
     <ul>     
     <xsl:for-each select="..//outline">
        <li>        
        <xsl:choose>
          <xsl:when test="@rel_url='$this_page'">
           <strong>
             <xsl:value-of select="@text" />             
           </strong>
          </xsl:when>          
          <xsl:otherwise>
            <a>       
             <xsl:attribute name="href">
             <xsl:value-of select="@rel_url"/></xsl:attribute>
             <xsl:value-of select="@text" />
           </a>               
          </xsl:otherwise>       
        </xsl:choose>   
       </li> 
     </xsl:for-each>  
     </ul>            
  </xsl:if>  
</xsl:template>



</xsl:stylesheet>
The XSL file shows all the pages in each gallery and shows the specific page the user is on unlinked and in bold. Now here is how I included it in the web page

PHP Code:
<?php

//Work out the page name
$this_page basename($_SERVER['SCRIPT_NAME']);



// Load the XML source
$xml = new DOMDocument;
$xml->load('structure.xml');

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

// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules

echo $proc->transformToXML($xml);
?>
When I replace test="@rel_url='$this_page'" with a literal page name (e.g. test="@rel_url='content-page1.php'") it works fine, but obviously I need to pass the variable $this_page, because i would never know which page the user was on.

So my question is how can I pass the page name as a variable to my xsl:if and xsl:when statements?

Thanks
Steven