The transformation is not returning anything new, just the comment segment as it was before sending it to rdfpic2html. I am trying to modify http://www.ozhiker.com/electronics/pjmt/ PJMT's JPEG.php to transform http://jigsaw.w3.org/rdfpic/ rdfpic xml in the comment segment of jpegs and return it to Example.php

function Interpret_Comment_to_HTML( $jpeg_header_data )
{
       // Create a string to receive the output
       $output = "";

       // read the comment segment
       $comment = get_jpeg_Comment( $jpeg_header_data );

       // Check if the comment segment was valid
       if ( $comment !== FALSE )
       {
// Check if the string contains an indicator that there may be rdfpic metadata
       if (stristr($comment, 'PhotoRDF') !== FALSE)
       {
       $rdfpicdata = stristr($comment, '<?xml');
        rdfpic2html( $rdfpicdata );
$output .= "<h2 class=\"JPEG_Comment_RDFPIC_Heading\">JPEG RDFPIC Metadata</h2>\n"; $output .= "<p class=\"JPEG_RDFPIC_Text\">$rdfpichtml</p>\n";
       }
               // Comment exists - add it to the output
$output .= "<h2 class=\"JPEG_Comment_Main_Heading\">JPEG Comment</h2>\n"; $output .= "<p class=\"JPEG_Comment_Text\">$comment</p>\n";
       }

       // Return the result
       return $output;
}

function rdfpic2html( $rdfpicdata )
{
  $arguments = array('/_rdf' => $rdfpicdata);
  $xsltproc = xslt_create();
  xslt_set_encoding($xsltproc, 'ISO-8859-1');
$rdfpichtml = xslt_process($xsltproc, 'arg:/_rdf', 'rdfpic.xsl', NULL, $arguments);
// $Toolkit_Dir/$rdfpicxsl not working ? why
  if (empty($rdfpichtml)) {
      die('XSLT processing error: '. xslt_error($xsltproc));
  }
  xslt_free($xsltproc);
// echo $rdfpichtml; this returns the correct data to the browser but not when and where I want it
  return $rdfpichtml;
}

rdfpic.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns="http://www.w3.org/TR/REC-html40";
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
xmlns:rdfs="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#";
xmlns:DC="http://purl.oclc.org/dc/documents/rec-dces-199809.htm#";
xmlns:Technical="http://www.w3.org/2000/PhotoRDF/technical-1-0#";
xmlns:s0="http://www.w3.org/2000/PhotoRDF/technical-1-0#";
xmlns:s1="http://www.w3.org/2000/PhotoRDF/dc-1-0#";
xmlns:s2="http://sophia.inria.fr/~enerbonn/rdfpiclang#";
version="1.0">
<xsl:comment>is REC-html40 better/more recent? xmlns="http://www.w3.org/1999/09/28-Photo-ns#";</xsl:comment>
<xsl:output method="html" indent="no"/>
<xsl:comment>These are the only namespaces I have seen used. This is a catch all template for
all these namespaces and nodes</xsl:comment>
<xsl:template match="DC:*|Technical:*|s2:*|s1:*|s0:*">
<br /><xsl:value-of select="local-name()"/>:
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>

xml array data is:
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
xmlns="http://www.w3.org/1999/09/28-Photo-ns#";
xmlns:DC="http://purl.oclc.org/dc/documents/rec-dces-199809.htm#";
xmlns:Technical="http://www.w3.org/2000/PhotoRDF/technical-1-0#";>
<rdf:Description about="for awhile">
<DC:Description>Take one</DC:Description>
<DC:Type>image/jpeg</DC:Type>
<DC:Subject>computers</DC:Subject>
<DC:Source>ccd</DC:Source>
<DC:Rights>public domain</DC:Rights>
<DC:Title>Lets get this working</DC:Title>
<DC:Date>2005-04-20</DC:Date>
<DC:Coverage>USA</DC:Coverage>
<DC:Creator>Me</DC:Creator>
<Technical:devel-date>2005-05-01</Technical:devel-date>
<Technical:lens>Minolta AF70-210</Technical:lens>
<Technical:camera>Minolta800i</Technical:camera>
<Technical:film>Fuji</Technical:film>
</rdf:Description>
</rdf:RDF>

Aloha, Eric

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

Reply via email to