Hello all,

I'm having a real problem with applying an xslt transform to a selected part of an xml document. I load the xml document using simplexml_load_file, and the same with the xsl file. Using the xpath function for simplexml I select a part of the xml document and store it in a different variable. I then apply the xml transform to that variable, however the transform actually applies to the whole xml document, rather than just the selected part in the new variable. I can't figure out why it does this. Does anyone know? The code I'm used is below.

   $xml = simplexml_load_file ( 'simple_test.xml' );

    if ( isset ( $_GET['s'] ) && isset ( $_GET['ss'] ) )
foreach ( $xml->xpath( "//[EMAIL PROTECTED]'".$_GET['s']."']/ [EMAIL PROTECTED]'".$_GET['ss']."']" ) as $subsection)
            $content = $subsection;

    $xsl = simplexml_load_file( 'simple_test.xsl' );
    $proc = new XsltProcessor();
    $proc->importStylesheet($xsl);
    echo $proc->transformToXML($content);

Thanks for any help
Allan

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

Reply via email to