Link to home
Start Free TrialLog in
Avatar of JohnnyOffTheSpot
JohnnyOffTheSpot

asked on

Need XSL code to skip output if a condition is met in a tag, again.

Gertone answered this question previously with the attached code.
This code has worked wonders for those tags that are empty or have differing amounts of characters in them.
I have finally stumbled upon a tag that will contain either an X or an N.  If it contains an X, that I have to skip that line from being printed.
I have tried variations of the following:
<xsl:if test="contains(normalize-space(Rtype01), X)">
and
<xsl:if test="match(normalize-space(RateTypeMinBill), X)">
Even if I get past the syntax errors, it just prints my line regardless.
  I think what I need to do is say something like, if test="match..... then call the normalize-space function but I am doing something(many things, all things) wrong.

Thanks in advance for any help.
<xsl:value-of select="$Line1_AppNumber"/>
        <xsl:value-of select="$nl"/>
        <xsl:if test="string-length(normalize-space(Rtype01)) > 0">
            <xsl:value-of select="$Line2_Rtype01"/>
            <xsl:value-of select="$nl"/>
        </xsl:if>
        <xsl:value-of select="$Line3_Rtype02"/>
        <xsl:value-of select="$nl"/>

Open in new window

Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

you are testing the value of the element X,
you should test for string values (add single quotes)
and no need for the normalize-space in the test
<xsl:if test="contains(Rtype01, 'X')">
Avatar of JohnnyOffTheSpot
JohnnyOffTheSpot

ASKER

i'm so confused.  I thought that the normalize-space was what was removing the line if the condition was met.
Why does this remove the line then?
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
above and beyond.  Thank you again, Gertone!