Ciao,
devo fare un xsl che prenda dei punti di interesse (POI), ci aggiunga la distanza rispetto ad un punto passato tramite php e li ordini rispetto a questa distanza.
Il problema credo che sia nel riordinarli..
L'errore che mi dà è questo: Warning: Sablotron error on line 6: XSL element 'apply-templates' cannot contain element 'copy-of' at this point in (nome pagina php)codice:<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl"> <xsl:template match="/"> <pois> <xsl:apply-templates select="*[local-name()='poi'][position() < 6]"> <xsl:sort select="distance"/> <xsl:copy-of select="./*"/> </xsl:apply-templates> </pois> </xsl:template> <xsl:template match="//poi"> <xsl:variable name="dist_x" > <xsl:value-of select="$user_lat - @latitude" /> </xsl:variable> <xsl:variable name="dist_y" > <xsl:value-of select="$user_lon - @longitude" /> </xsl:variable> <xsl:variable name="distance" > <xsl:value-of select="php:function('sqrt',string(($dist_x*$dist_x) + ($dist_y*$dist_y)))"/> </xsl:variable> <poi> <xsl:copy-of select="./*"/> <distance> <xsl:value-of select="php:function('round', string($distance), 2)*100"/> </distance> </poi> </xsl:template> </xsl:stylesheet>
help!!
![]()
![]()
![]()

Rispondi quotando