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

<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
		<dateCreated>Tues, 4 Nov 2008 16:00:00 GMT</dateCreated>
		<dateModified>Tues, 4 Nov 2008 16:00:00 GMT</dateModified>
		<ownerName>Steven Price</ownerName>
		<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 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			
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

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 

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

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

<xsl:template match="outline">  

  <xsl:if test="@rel_url='$this_page'">         
     <xsl:for-each select="..//outline">
          <xsl:when test="@rel_url='$this_page'">
             <xsl:value-of select="@text" />             
             <xsl:attribute name="href">
             <xsl:value-of select="@rel_url"/></xsl:attribute>
             <xsl:value-of select="@text" />

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:

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

// Load the XML source
$xml = new DOMDocument;

$xsl = new DOMDocument;

// 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?