Jump to content
Server Maintenance This Week. ×

Stylesheet export inserts extra Return when last field is empty


Cabinetman

This topic is 4542 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I guess the question is any ideas on how to change this so that if an exported field is empty I don't get an extra $newrecord but do still get the $newrecord needed at the end of each record???

Note: setting Qu to '0' if empty is not an option....

Example:

ItemName Price Qu

Product1 $9.95

Product2 $7.95

Product3 $8.95

This may not show but there is a tab after each price before the return/new line

Yet I get:

ItemName Price Qu

Product1 $9.95

Product2 $7.95

Product3 $8.95

Here's the stylesheet section.......


           	 <xsl:choose>

                    <xsl:when test="position()=last()">

                        <xsl:value-of select="fmp:DATA"/>

                        <xsl:value-of select="$newrecord"/>

                    </xsl:when>

                    <xsl:otherwise>

                        <xsl:value-of select="fmp:DATA"/>

                        <xsl:value-of select="$delimiter"/>

                    </xsl:otherwise>

                </xsl:choose>

Thanks to anyone who can help.....

Link to comment
Share on other sites

  • 2 weeks later...

put an xsl:if around the xsl:choose. test for != '' (xsl:if test="fmp:DATA != ''") or actually you want to make it another xsl:when in the xsl:choose, so that you can also test for the last record (even if empty, add the $newrecord...)

when fmp:DATA = '' AND last record, $newrecord

when fmpDATA != '' AND last record, $newrecord

otherwise, $delimiter

Maybe the entire XSLT would help??

Link to comment
Share on other sites

Sorry people ..... I've been sick and out of it for a while.

Just now catching up on things....

Maybe the entire XSLT would help??

I'm just using the basic FMP example, with a little editing, which I posted on another topic.:

http://fmforums.com/...__fromsearch__1

I'll see how this works and repost here if it does....

Thanks Beverly

EDIT : I go back to test it and it's working fine WITHOUT changing the xsl ..... huummmmmm.

EDIT#2 : You gave me an idea that actually would help me a lot ...... what if all three fields were empty, or basically an empty record?

Link to comment
Share on other sites

This topic is 4542 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.