How do I test the value of a variable in a <xsl:if ...> statement?

Discussion in 'XML' started by mark4asp, Dec 20, 2007.

  1. mark4asp

    mark4asp Guest

    I'm getting a problem with this code and I think the offending linke is
    :

    <xsl:if test="$folder = 'Search'">

    I want to test the value of the Folder element for a value of precisely
    "Search" and include the extra html as shown below if the test passes.
    The rest of the code validates and so, I hope, works.

    What am I doing so very wrong here?


    This is a relevant fragment of the xml:

    <BatchEmail>
    <Domain>www.mydomain.com</Domain>
    <Destination>
    <Folder>Search</Folder>
    </Destination>
    ...
    ...
    <BatchEmail>



    Here is my problem code snippet. When I cut this snippet (below) out
    the rest of the code parses with no problems:


    blah blah...

    <xsl:variable name="domain" select="BatchEmail/Domain" />
    <xsl:variable name="folder" select="BatchEmail/Destination/Folder" />

    blah blah blah...

    <xsl:if test="$folder = 'Search'">
    <table cellspacing="0">
    <tr>
    <th class="link"><a href="http://{$domain}/Search/Search.aspx"><span
    class="full">Search Database</span></a></th>
    </tr>
    <tr>
    <td>Search over 5000 reports on over 1600 investors.<br /><a
    class="blue" href="http://{$domain}/Search/Search.aspx">click
    here.</a><br/><br/></td>
    </tr>

    <tr>
    <th class="link"><a
    href="http://{$domain}/Analysis/Analysis.aspx"><span
    class="full">Analysis</span></a></th>
    </tr>
    <tr>
    <td>Monitor contract wins, cross reference based on consultant,
    mandate size, asset class, investment style and manager. Generate your
    own league tables of manager inflows and mandate wins. Analyse capital
    flows broken down by asset class and identify trends in consultant
    manager selections.<br /><a class="blue"
    href="http://{$domain}/Analysis/Analysis.aspx">click
    here.</a><br/><br/></td>
    </tr>

    <tr>
    <th class="link"><a href="http://{$domain}/Survey/Survey.aspx"><span
    class="full">Marketplace Survey</span></a></th>
    </tr>
    <tr>
    <td>Quarterly Report. Coverage on the major deals, quantifiable net
    inflows and out flow charts, net capital flows by asset class and style
    and number of investors expressing an interest in a particular asset
    class.<br /><a class="blue"
    href="http://{$domain}/Survey/Survey.aspx">click here.</a></td>
    </tr>
    </table>
    </xsl:if>

    blah blah blah blah...
     
    mark4asp, Dec 20, 2007
    #1
    1. Advertising

  2. In article <476aa8ca$0$20510$>,
    mark4asp <> wrote:

    >I'm getting a problem with this code


    What is the problem you are having with it?

    -- Richard
    --
    :wq
     
    Richard Tobin, Dec 20, 2007
    #2
    1. Advertising

  3. mark4asp wrote:
    > I'm getting a problem with this code and I think the offending linke is
    > :
    >
    > <xsl:if test="$folder = 'Search'">
    >
    > I want to test the value of the Folder element for a value of precisely
    > "Search" and include the extra html as shown below if the test passes.
    > The rest of the code validates and so, I hope, works.
    >
    > What am I doing so very wrong here?


    What problem exactly do you get?

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Dec 20, 2007
    #3
  4. mark4asp

    P. Lepin Guest

    Martin Honnen wrote:
    > mark4asp wrote:
    >> <xsl:if test="$folder = 'Search'">
    >>
    >> I want to test the value of the Folder element for a value of precisely
    >> "Search" and include the extra html as shown below if the test passes.
    >> The rest of the code validates and so, I hope, works.
    >>
    >> What am I doing so very wrong here?

    >
    > What problem exactly do you get?


    You guys are entirely too nice and warmhearted fellas. I think such
    unnatural kindness to strangers should be legally prohibited so as not to
    make vindictive morons like me feel bad whenever you politely and patiently
    ask neophytes for essential clarifications as observed on this thread.

    --
    Presented in Brain Control where available.
     
    P. Lepin, Dec 20, 2007
    #4
  5. mark4asp

    mark4asp Guest

    Richard Tobin wrote:

    > In article <476aa8ca$0$20510$>,
    > mark4asp <> wrote:
    >
    > > I'm getting a problem with this code

    >
    > What is the problem you are having with it?
    >
    > -- Richard


    I've decided to abandon this thread. It's hard to say what difficulty
    I'm having as the only error message I get from the editor when I try
    to save is "Invalid file".

    I've written another post below which is far more specific and gets
    right down to the meat of the problem I'm trying to solve.
     
    mark4asp, Dec 21, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karsten Weinert
    Replies:
    3
    Views:
    1,062
    Karsten Weinert
    Jul 5, 2004
  2. MC
    Replies:
    1
    Views:
    7,347
    David Carlisle
    Mar 24, 2005
  3. Replies:
    1
    Views:
    3,687
    A. Bolmarcich
    May 27, 2005
  4. Replies:
    2
    Views:
    9,353
    Martin Honnen
    Sep 5, 2006
  5. michael75
    Replies:
    0
    Views:
    1,859
    michael75
    Aug 3, 2010
Loading...

Share This Page