Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/05/2004, 01:45
Avatar de Helbira
Helbira
 
Fecha de Ingreso: octubre-2001
Ubicación: Sevilla, España
Mensajes: 1.228
Antigüedad: 22 años, 6 meses
Puntos: 5
Genial!!

Después de ver esto y conociendo lo cortito que es XSL en cuanto a "funciones" de tratamiento de cadenas, se podría centralizar en un POST funciones útiles como esta implementadas en XSL.

Asi que.... aquí va mi aportación y mensajito reportado a moderadores

split.xsl

Código PHP:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="split">
   <xsl:call-template name="split">
      <xsl:with-param name="string" select="'Foros del Web'" />
      <xsl:with-param name="pattern" select="' '" />
   </xsl:call-template>
</xsl:template>

<xsl:template name="split">
 <xsl:param name="string" />
 <xsl:param name="pattern" />
 <xsl:choose>
      <xsl:when test="contains($string, $pattern)">
           <xsl:if test="not(starts-with($string, $pattern))">
            <xsl:call-template name="split">
                 <xsl:with-param name="string" select="substring-before($string, $pattern)" />
                 <xsl:with-param name="pattern" select="$pattern" />
            </xsl:call-template>
       </xsl:if>
         <xsl:call-template name="split">
            <xsl:with-param name="string" select="substring-after($string, $pattern)" />
            <xsl:with-param name="pattern" select="$pattern" />
       </xsl:call-template>
      </xsl:when>
  <xsl:otherwise>
<xsl:value-of select="$string" /> <br />
  </xsl:otherwise>
 </xsl:choose>
</xsl:template>

</xsl:stylesheet>
split.xml

Código PHP:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml
-stylesheet type="text/xsl" href="split.xsl"?>
<split>

</split>