XSL - xslt2.0 functions

 
Vista:

xslt2.0 functions

Publicado por Rodrigo (4 intervenciones) el 28/07/2005 14:18:37
Hola estoy intentando hacer una función usando xslt 2,0 y tengo el siguiente xsl

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
xmlns:local="www.altova.com/xslt2Example"
exclude-result-prefixes="xs xsi fn">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<!-- Archivo xslt que transforma una cabecera y una lista de pedidos para que tenga el formato deseado-->
<!-- Existen partes que se generan estaticamente, a falta de que se complete más el archivo xml fuente -->

<!-- Variables

<xsl:variable name="prim_substring" select="substring-before(document('lines.xml')/xml/registro/@Cantidades,'|')" />

-->

<xsl:function name="foo:compareCI">
<xsl:param name="string1"/>
<xsl:param name="string2"/>
<xsl:value-of select="compare(upper-case($string1),upper-case($string2))"/>
</xsl:function>


<xsl:template match="/"> <!-- El template se dispara cuando encuentra coincidencia con match -->
<html xmlns="http://www.w3.org/2002/06/xhtml2"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions">


<body>

compareCI red,blue: <xsl:value-of select="foo:compareCI('red','blue')"/>
compareCI red,red: <xsl:value-of select="foo:compareCI('red','red')"/>
compareCI red,Red: <xsl:value-of select="foo:compareCI('red','Red')"/>
compareCI red,Yellow: <xsl:value-of select="foo:compareCI('red','Yellow')"/>



</body>
</html>
</xsl:template>
</xsl:stylesheet>




y me sale el siguiente error al usar esat hoja de estilo xon un .xml:

Referencia a un prefijo de espacio de nombres no declarado: 'foo'.

¿cÓMO SE SOLUCIONA?

Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:xslt2.0 functions

Publicado por Iuav (29 intervenciones) el 01/08/2005 21:36:57
Hola,
El espacio de nombre foo no está declarada en esta sección:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
xmlns:local="www.altova.com/xslt2Example"
exclude-result-prefixes="xs xsi fn">
Es por la razón que te está dando error, deberías declarar con un espacio de nombre.
Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar