Subject: RE: [xsl] Cannot process a result tree fragment as a node-set under XSLT 1.0 - My alternative don´t function From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Sat, 12 Apr 2008 14:03:36 +0100 |
The node-set returned by the exsl:node-set() function will always contain a single (document or root) node. Perhaps you wanted its children: exsl:node-set()/*. However, it's not clear to me that you need to create an RTF in the first place. Why not define $filter as <xsl:variable name="filter" select="//RecursoEx1[($option=1 and F_FIN=$date1 and contains(TITULO,'o')) or ($option=2 and F_FIN=$date2)]"/> Note also, that horrible bit of disable-output-escaping can be avoided by setting the doctype-system and doctype-public attributes on xsl:output. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Alejandro [mailto:alexcontini@xxxxxxxx] > Sent: 12 April 2008 13:05 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Cannot process a result tree fragment as a > node-set under XSLT 1.0 - My alternative don4t function > > Hello, i want to recover any records in function of one > variable (option in this case), and i don4t know to do it. I > want to print the TITULO element the those records. > Can you help me, please? > > Cheers, > Alexander > > > ********************************* XML > ************************************* > > <?xml version="1.0"?> > > <List> > <RecursoEx1> > <TITULO>Sara Baras</TITULO> > <F_INICIO>20080125000000</F_INICIO> > <F_FIN>20080211000000</F_FIN> > </RecursoEx1> > > <RecursoEx1> > <TITULO>Exposicion de pintura</TITULO> > <F_INICIO>20080201000000</F_INICIO> > <F_FIN>20080211000000</F_FIN> > </RecursoEx1> > > <RecursoEx1> > <TITULO>Inaguracion de ...</TITULO> > <F_INICIO>20080205000000</F_INICIO> > <F_FIN></F_FIN> > </RecursoEx1> > > <RecursoEx1> > <TITULO>Clausura de ..</TITULO> > <F_INICIO>20080101000000</F_INICIO> > <F_FIN>20080205000000</F_FIN> > </RecursoEx1> > > </List> > > > ********************** XSL ********************** > > <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet > xmlns:i18n="http://apache.org/cocoon/i18n/2.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:exsl="http://exslt.org/common" > extension-element-prefixes="exsl" version="1.0"> > > <xsl:output method="html" media-type="text/html;charset=iso-8859-1" > indent="yes" encoding="ISO-8859-1" omit-xml-declaration="yes" /> > > <xsl:variable name="date1" select="20080205000000"></xsl:variable> > <xsl:variable name="date2" select="20080211000000"></xsl:variable> > <xsl:variable name="option" select="1"></xsl:variable> > > <xsl:template match="/"> > > <xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE > html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">]]></xsl:text> > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es"> > > <head> > <title>Gabinete of Prensa</title> > <meta http-equiv="Content-Type" content="text/html; > charset=iso-8859-1" > /> > </head> > > <body> > > <xsl:variable name="filter"> > <xsl:choose> > <xsl:when test="$option=1"> > <xsl:copy-of > select="//RecursoEx1[F_FIN=$date1 and > contains(TITULO,'o')]"/></xsl:when> > <xsl:otherwise> > <xsl:copy-of > select="//RecursoEx1[F_FIN=$date2]"/></xsl:otherwise> > </xsl:choose> > </xsl:variable> > > > > > > <p>Number: <xsl:value-of > select="count(exsl:node-set($filter))"/></p> <!-- DON'T FUNCTION --> > > <xsl:for-each select="exsl:node-set($filter)"> > <p><xsl:value-of > select="exsl:node-set($filter)/TITULO"/></p> <!-- > DON'T FUNCTION --> > </xsl:for-each> > > </body> > </html> > </xsl:template> > > </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Cannot process a result t, Alejandro | Thread | Re: [xsl] Cannot process a result t, Alejandro |
Re: [xsl] Cannot process a result t, Martin Honnen | Date | Re: [xsl] Cannot process a result t, Alejandro |
Month |