note 46207 added to function.xsl-xsltprocessor-transform-to-uri

From: Date: Sat, 02 Oct 2004 11:23:59 +0000
Subject: note 46207 added to function.xsl-xsltprocessor-transform-to-uri
Groups: php.notes 
Request: Send a blank email to php-notes+get-77736@lists.php.net to get a copy of this message
you have these two simple XML and XSL files: --simpletree.xml-- <collection> <cd> <title>PHP Rock</title> <artist>Joe Coder</artist> <year>2003</year> </cd> <cd> <title>Squashing Typos on a Winter's Eve</title> <artist>kennyt</artist> <year>2004</year> </cd> </collection> --simpletree.xsl-- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="iso-8859-1" indent="no"/> <xsl:template match="collection"> Hey! Welcome to my sweet CD collection! <xsl:apply-templates/> </xsl:template> <xsl:template match="cd"> <h1><xsl:value-of select="title"/></h1> <h2>by <xsl:value-of select="artist"/></h2> <h3> - <xsl:value-of select="year"/></h3> </xsl:template> </xsl:stylesheet> Now its time to teach you for what is transformToURI() =) --simpletree.php-- <?php /* Load the two XML sources */ $xml = new DomDocument; // from /ext/dom $xml->load('simpletree.xml'); $xsl = new DomDocument; $xsl->load('simpletree.xsl'); /* Configure the transformer */ $proc = new xsltprocessor; $proc->importStyleSheet($xsl); // attach the xsl rules /* the function below will write an file contain all infos about the two files above */ $proc->transformToURI($xml, 'file.txt'); ?> --file.txt-- Hey! Welcome to my sweet CD collection! PHP Rockby Joe Coder - 2003 Squashing Typos on a Winter's Eveby kennyt - 2004 ---- Manual Page -- http://www.php.net/manual/en/function.xsl-xsltprocessor-transform-to-uri.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46207 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46207&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46207&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77736) next »