Re: [xsl] xsl:variable and node list

Subject: Re: [xsl] xsl:variable and node list
From: "Luke Ambrogio" <luke.ambrogio@xxxxxxxxxxxx>
Date: Wed, 15 Oct 2003 10:41:31 +0200
ok i combined the variable into one

          <xsl:variable name="searchfields"
select="tblMIMCompanies[contains(translate(@name,$upperCase,$lowerCase),tran
slate($name,$upperCase,$lowerCase))
           and
(contains(translate(@building,$upperCase,$lowerCase),translate($address,$upp
erCase,$lowerCase))
                                   or
contains(translate(@number,$upperCase,$lowerCase),translate($address,$upperC
ase,$lowerCase))
                                    ...
                                   or
contains(translate(@address,$upperCase,$lowerCase),translate($address,$upper
Case,$lowerCase)))
                                   and
contains(translate(@products,$upperCase,$lowerCase),translate($products,$upp
erCase,$lowerCase))
                                   and
contains(translate(@services,$upperCase,$lowerCase),translate($services,$upp
erCase,$lowerCase))]"/>

and used only that

<xsl:for-each select="$searchfields">
       <xsl:if test="position() &lt;= $recordsPerPage * number($pageNumber)
and position() &gt;= $recordsPerPage * number(($pageNumber)-1)">
        <xsl:apply-templates select="."/>
       </xsl:if>
      </xsl:for-each>

and it returns the companies with specified name, address, products and
services :)

a lot of respect to all of you out there!

regards Luke

----- Original Message ----- 
From: "Luke Ambrogio" <luke.ambrogio@xxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, October 15, 2003 10:11 AM
Subject: Re: [xsl] xsl:variable and node list


> ok guys that was amazing thanks a lot, hope fully one last thing
>
> i need to do a search (as u might have realized) on the name and address
and
> other fields.
> Im firstly storing the result on each field seperately in a variable then
i
> need need to combine them again into one sorted node-list and display them
>
> i've got
>
> <xsl:for-each select="$withname">
>   <xsl:if test="position() &lt;= $recordsPerPage * number($pageNumber) and
> position() &gt;= $recordsPerPage * number(($pageNumber)-1)">
>     <xsl:apply-templates select="."/>
>   </xsl:if>
> </xsl:for-each>
> <xsl:for-each select="$withaddress">
>   <xsl:if test="position() &lt;= $recordsPerPage * number($pageNumber) and
> position() &gt;= $recordsPerPage * number(($pageNumber)-1)">
>     <xsl:apply-templates select="."/>
>   </xsl:if>
> </xsl:for-each>
> ...
>
> how can i combine them into one, always keeping them sorted?
>
> thanks
>
> ----- Original Message ----- 
> From: "Anton Triest" <anton@xxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Friday, October 15, 2004 9:55 AM
> Subject: Re: [xsl] xsl:variable and node list
>
>
> > Jarno.Elovirta@xxxxxxxxx wrote:
> >
> > >But, if you just want a set, then
> > >
> > >  <xsl:copy-of
>
select="tblMIMCompanies[contains(translate(@building,$upperCase,$lowerCase),
> translate($address,$upperCase,$lowerCase))
> > >                                   and
>
contains(translate(@number,$upperCase,$lowerCase),translate($address,$upperC
> ase,$lowerCase))
> > >                                   and
>
contains(translate(@street,$upperCase,$lowerCase),translate($address,$upperC
> ase,$lowerCase))
> > >                                   and
>
contains(translate(@town,$upperCase,$lowerCase),translate($address,$upperCas
> e,$lowerCase))
> > >                                   and
>
contains(translate(@postcode,$upperCase,$lowerCase),translate($address,$uppe
> rCase,$lowerCase))
> > >                                   and
>
contains(translate(@country,$upperCase,$lowerCase),translate($address,$upper
> Case,$lowerCase))
> > >                                   and
>
contains(translate(@address,$upperCase,$lowerCase),translate($address,$upper
> Case,$lowerCase))]"/>
> > >
> > >
> > Jarno,
> > shouldn't that be 'or' instead of 'and'?
> >
> > Also, if you can be sure there are no other attributes that might
> > contain $address, you can do this:
> >
> > <xsl:variable name="withaddress"
> >
>
select="tblMIMCompanies[contains(translate(@*,$upperCase,$lowerCase),transla
> te($address,$upperCase,$lowerCase))]"/>
> >
> > (that would include all elements where *any* attribute contains
$address)
> >
> > Anton

Current Thread