Re: [xsl] Cannot process a result tree fragment as a node-set under XSLT 1.0 - My alternative don´t function

Subject: Re: [xsl] Cannot process a result tree fragment as a node-set under XSLT 1.0 - My alternative don´t function
From: "Alejandro" <alexcontini@xxxxxxxx>
Date: Sat, 12 Apr 2008 14:27:33 +0100
Hi Martin,

ItB4s correct.

I want to count the RecursoEx1 elements
<p>Number: <xsl:value-of select="count(exsl:node-set($filter)/RecursoEx1)"/></p>
although with your sample document and stylesheet variables that count is 0. OK!!


I want to iterate over the RecursoEx1 elements
<xsl:for-each select="exsl:node-set($filter)/RecursoEx1">      OK!!

Martin:

But it is not clear what you want to achieve and why you use xsl:copy-of
and exsl:node-set, it looks to me as if that might not be necessary at all.

I use xsl:copy-of and exsl:node-set because to error "Cannot process a result tree fragment as a node-set under XSLT 1.0" if i code :

<xsl:variable name="filtro">
<xsl:choose>
<xsl:when test="$option=1">
<xsl:copy-of select="//RecursoEx1[F_FIN=$date1]"/></xsl:when>
<xsl:otherwise>
<xsl:copy-of select="//RecursoEx1[F_FIN=$date2]"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>


<p>Number: <xsl:value-of select="$filter"/></p>

   <xsl:for-each select="$filter">
        <p><xsl:value-of select="TITULO"/></p>
   </xsl:for-each>


and i donB4t know if exits another posibility. Exists??


The variable "option" is to received from one formulary, but there are more and then the "filter" will be dynamic.

How can i do to construct the filter dynamic? For example, i receive one varible named "title" from the formulary with the value: "John Martin Car Monday" and i like to enumerate the RecursoEx1 elements that meet with this condition: TITLE=John or TITLE=Martin or TITLE=Car or TITLE=Monday.

or title variable is Apple Pencil, ..... then the condition will be TITLE=Apple or TITLE=Pencil

i donB4t know how may parameters i will receive in advance



Fine Thanks,
Alexander

PD: My english is very bad :)

----- Mensaje original ----- De: "Martin Honnen" <Martin.Honnen@xxxxxx>
Para: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Enviado: sC!bado, 12 de abril de 2008 13:32
Asunto: Re: [xsl] Cannot process a result tree fragment as a node-set under XSLT 1.0 - My alternative donB4t function



Alejandro wrote:

<p>Number: <xsl:value-of select="count(exsl:node-set($filter))"/></p> <!-- DON'T FUNCTION -->

count should give 1. I guess you want to count the RecursoEx1 elements so you should use
count(exsl:node-set($filter)/RecursoEx1)
although with your sample document and stylesheet variables that count is 0.


<xsl:for-each select="exsl:node-set($filter)">

I guess you want to iterate over the RecursoEx1 elements so you would need <xsl:for-each select="exsl:node-set($filter)/RecursoEx1">


But it is not clear what you want to achieve and why you use xsl:copy-of and exsl:node-set, it looks to me as if that might not be necessary at all.



--


Martin Honnen
http://JavaScript.FAQTs.com/

Current Thread