xsl-list
[Top] [All Lists]

Re: xsl:variable and node list

2003-10-15 01:41:31
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(_dot_)ambrogio(_at_)alert(_dot_)com(_dot_)mt>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
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(_at_)cking(_dot_)be>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Friday, October 15, 2004 9:55 AM
Subject: Re: [xsl] xsl:variable and node list


Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com 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

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--





<Prev in Thread] Current Thread [Next in Thread>