Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL v XSLT unsupported data-type and sort

Status
Not open for further replies.

csbdeady

Programmer
May 18, 2002
119
GB
Hi Folks!

In PHP4 using the Sablotron and Expat extension I used PHP's XSLT functions to process XML with XSL to produce HTML.

Using PHP5 with the same XML and XSL I get the following warning errors:

Warning: compilation error: file
file:///....../eventlistnumerate.xsl element sort in d:\apache\.......\xmltest.php on line 12

Warning xsltSortComp: no support for data-type = numeric in
d:\apache\.......\xmltest.php on line 12

I would prefer not to have to get XSLT working from PECL now that it is no longer a part of the core PHP5.

Please can a friendly bod let me know what is going wrong :)

Many thanks
-Colin
 
have you got a sample of the xml and xslt that causes the error please?
 
Oops! Should have enclosed that, here are the files in full:

You'll notice the XML isn't exactly complex at the moment;)

I am basically expecting a blank "eventlisting" to be displayed without error.

XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<eventlisting>
 <events>
  </events>
</eventlisting>
XSL:
Code:
<xsl:stylesheet version = '1.0'
xmlns:xsl='[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform'>[/URL]

<xsl:output method="html" indent="yes"/>

<xsl:param name="sortorder" />
<xsl:param name="eventaction" />

 
<xsl:template match="events">
    <xsl:variable name="sortorder"><xsl:value-of select="sortorder" /><xsl:value-of select="$sortorder" /></xsl:variable>
 <table border="0" width="400">
  <tr>
   <td colspan="2">
    <em class="gr">
     Please select the event to <xsl:value-of select="$eventaction" />.
    </em> 
   </td>
  </tr>

  <xsl:apply-templates >
  <xsl:sort order="{$sortorder}" select="concat(substring(startdate, 7,2),substring(startdate, 4,2),substring(startdate, 1,2))" data-type="numeric" /> 
  </xsl:apply-templates>
 </table>
</xsl:template>

<xsl:template match="event">
 <tr>
  <td width="250"><a href="page.php?action=go{$eventaction}event&amp;eventID={@eventID}"><em class="sm"><xsl:value-of select="name" /></em></a></td>
  <td width="48"><em class="gr"><xsl:value-of select="startdate" /></em></td>
 </tr>
 <tr>
  <td colspan="2"><img src="images/linefade.gif" alt="" border="0" width="300" height="3" /></td>
 </tr> 
</xsl:template>
 
</xsl:stylesheet>
 
Thinking about this one a little bit more - I am of course making the assumption that the XML and XSLT that the PHP5 XSL extension can handle is the same as that for the PHP4 XSLT extension using Sablotron. Is this the case?

If it is, I'm still stuck - I retried my code again on a PHP4 installation and it worked. I then upgraded that installation to PHP5 and modified the code to work with PHP5-XSL instead of PHP4-XSLT and it failed as described above.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top