note 28797 added to ref.xslt

From: Date: Fri, 24 Jan 2003 06:46:56 +0000
Subject: note 28797 added to ref.xslt
Groups: php.notes 
Request: Send a blank email to php-notes+get-42674@lists.php.net to get a copy of this message
I'm having problems with the sablot module outputting text inside tags that I do not specify for output. Not exacly sure why. I'm not sure if this is a fault of Sablotron or the php module. But heres an example. I have an XML fragment that looks like this. <show date="1/1/2003" day="1" dayofweek="FRI" time="9:00pm" price="$8"> <bands> <band> <lineup>1</lineup> <link>http://somelink.com</link> <bandname>SOME BAND</bandname> <label>Some Record Label</label> </band> <band> <lineup>2</lineup> <bandname>ANOTHER BAND</bandname> <label>Another Record Label</label> </band> <band> <lineup>3</lineup> <bandname>THE OPENERS</bandname> <label>Quality Records</label> </band> </bands> <description>This is a description of the show... Lost of stuff in here.... blah blah blablahh.....</description> </show> And I have an XSLT doc that is much like this more or less. <?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="UTF-8" indent="yes" /> <xsl:template match="show"> <span class="bold"><xsl:value-of select="@dayofweek" />. <xsl:value-of select="@date" /></span> (<xsl:value-of select="@time" />; <xsl:value-of select="@price" /> <a href="http://buyticketshere.com">buy!</a>)<br /> <xsl:apply-templates /> </xsl:template> <xsl:template match="bands"> <xsl:for-each select="band"> <b> <xsl:choose> <xsl:when test="link"> <a> <xsl:attribute name="href"> <xsl:value-of select="link" /> </xsl:attribute> <xsl:value-of select="bandname" /> </a> </xsl:when> <xsl:otherwise> <xsl:value-of select="bandname" /> </xsl:otherwise> </xsl:choose> </b> <xsl:if test="label"> (<xsl:value-of select="label" />)</xsl:if> <br /> </xsl:for-each> <br /> </xsl:template> </xsl:stylesheet> Then process them with the xslt_process() method, and I get output that looks like this... <?xml version="1.0" encoding="UTF-8"?> <span class="bold">MON. 1/25/2003 </span> (9:00pm; $8 <a href="http://buyticketshere.com">buy! </a>) <br/> <b> <a href="http://somelink.com">SOME BAND </a> </b> (Some Record Label) <br/> <b>ANOTHER BAND </b> (Another Record Label) <br/> <b>THE OPENERS </b> (Quality Records) <br/> <br/> This is a description of the show... Lost of stuff in here.... blah blah blablahh..... What's up with that?!?! I didn't specify that the <description> is to be displayed. And also notice the <xml> tag? I was specifying HTML output. This is crazy. I do not get the same results using MSXML. Any idea anyone? -- http://www.php.net/manual/en/ref.xslt.php http://master.php.net/manage/user-notes.php?action=edit+28797 http://master.php.net/manage/user-notes.php?action=delete+28797 http://master.php.net/manage/user-notes.php?action=reject+28797

« previous php.notes (#42674) next »