[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Setting flags ?

Subject: Re: Setting flags ?
From: "Carsten Klein" <carstenklein@xxxxxxxx>
Date: Tue, 30 Jul 2002 07:12:45 +0200
xsl flags
Hi John,

the problem with the variable, is that is out of scope. It is valid only
within the <xsl:for-each/> loop or from within
templates being called either by <xsl:call-template/> or
<xsl:apply-templates/> with additional <xsl:with-param/>
instructions.

It is not valid when being used inside the <xsl:choose/> at the end of your
stylesheet.

One question: the <option/> nodes, which you intentionally left empty, are
they the same for all
of the matches/tests inside the <xsl:for-each/> loop ?

If so, then why don't you just rewrite the whole bunch of <xsl:when/>'s and
the likes to match the following, selecting
all the nodes you want to match into a node-set contained in a variable:

<xsl:variable name="matches"
select="index/indexitem[contains(@text,$searchValue1)
or contains(@text,translate($searchValue1,'abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))
or
contains(@text,concat(translate(substring($searchValue1,1,1),'abcdefghijklmn
opqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'),substring($searchValue1,2)))"/>

This should result in the variable $matches containing a node-set which
contains the nodes which match your query or
the empty node-set.

You would then be able to

<xsl:choose>
    <xsl:when test="$matches">
        <!-- there were some matches...-->
        <xsl:for-each select="$matches/*">
            <!-- ... -->
        </xsl:for-each>
    </xsl:when>
    <xsl:otherwise>
        <!-- no matches found -->
    </xsl:otherwise>

Haven't tested this though, but it should give you a hint into the right
direction, I suppose.

Bye

Carsten


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.