Re: [xsl] Help on node selection

Subject: Re: [xsl] Help on node selection
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Fri, 27 Aug 2010 05:30:31 -0700
On Fri, Aug 27, 2010 at 5:19 AM, Fabien Tillier <f.tillier@xxxxxxxx> wrote:
> Well, it is not what I want. The XML is a lot more complex
> That's why I didn't put an output at first...
> I want to know the syntax to call a template with a list of nodes, based on
a criteria.


<xsl:call-template name="processRows">
  <xsl:with-param name="pRows" select="row[N1=1]"/>
</xsl:call-template>


Read about <xsl:param>.


--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play


>
> I will probably have several templates, like
>
> <xsl:template match="data/row[N1=1]">
>
> </xsl:template>
>
> <xsl:template match="data/row[N1=2]">
>
> </xsl:template>
>
> To be able to handle this level (N1), then, once I get all nodes which match
the N1=1 clause (or any number than 1), I will have to call other templates to
generate several tables for the node group I get.
> I know it is unclear...
> I want to treat all nodes which have a certain criteria (like N1=1) in a
template (and by all, I mean, call once the template with all matching nodes).
Then treat them again in another template to generate another set of tables,
and so on...
> Ideally, the XSL template will be built based on an XML file which gave, for
each criteria (like N1=1) the tables which have to be built, and on which
other criteria (like only for N2=120...).
>
> Thus, it is not really good XSL as the treatment will not be in document
order...
> Sorry for being thick...
>
> Regards,
> Fabien
>
>
>
>
> -----Message d'origine-----
> DeB : Andrew Welch [mailto:andrew.j.welch@xxxxxxxxx]
> EnvoyC)B : vendredi 27 aoC;t 2010 13:53
> CB : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> ObjetB : Re: [xsl] Help on node selection
>
>> <N1>120,120,110</N1>
>> <N2>120,120</N2>
>
> <xsl:template match="data">
> B <N1><xsl:value-of select="string-join(row[N1 eq '1']/N2, ', '))"/></N1>
> B <N2><xsl:value-of select="string-join(row[N1 eq '2']/N2, ', '))"/></N2>
> </xsl:template>
>
>
>> -----Message d'origine-----
>> DeB : Andrew Welch [mailto:andrew.j.welch@xxxxxxxxx]
>> EnvoyC)B : vendredi 27 aoC;t 2010 13:45
>> CB : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>> ObjetB : Re: [xsl] Help on node selection
>>
>>> My question is pretty basic, so far.
>>>
>>> Suppose I get an XML document
>>>
>>> <data>
>>> B  B  B <row>
>>> B  B  B B B B B B B B B B B B B B B B  <N1>1</N1>
>>> B  B  B <N2>120</N2>
>>> B  B  B </row>
>>> B  B  B <row>
>>> B  B  B B B B B B B B B B B B B B B B  <N1>1</N1>
>>> B  B  B <N2>120</N2>
>>> B  B  B </row>
>>> B  B  B <row>
>>> B  B  B B B B B B B B B B B B B B B B  <N1>2</N1>
>>> B  B  B <N2>120</N2>
>>> B  B  B </row>
>>> B  B  B <row>
>>> B  B  B B B B B B B B B B B B B B B B  <N1>2</N1>
>>> B  B  B <N2>120</N2>
>>> B  B  B </row>
>>> B  B  B <row>
>>> B  B  B B B B B B B B B B B B B B B B  <N1>1</N1>
>>> B  B  B <N2>110</N2>
>>> B  B  B </row>
>>> </data>
>> ...
>>> Is called on each matching node...(thus 3 times here), rather than once,
and then gets some loop to individually treat each node from the list.
>>> How can I proceed ?
>>
>> You need to provide the expected output for that input...
>>
>>
>> --
>> Andrew Welch
>> http://andrewjwelch.com
>>
>>
>
>
>
> --
> Andrew Welch
> http://andrewjwelch.com

Current Thread