
532 P.2d 237 (1975)
DEAN VINCENT, INC., an Oregon Corporation, Respondent,
v.
KRISHELL LABORATORIES, INC., an Oregon Corporation, Appellant.
Supreme Court of Oregon, In Banc.
Argued and Submitted February 4, 1975.
Decided February 27, 1975.
*238 Robert B. Hopkins, Portland, argued the cause for appellant. With him on the briefs were David W. Harper, and Keane, Haessler, Harper, Pearlman & Copeland, Portland.
Michael P. Ryan, Portland, argued the cause for respondent. With him on the brief were Thomas J. Lekas, and Lekas, Dicey & Marandas, Portland.
HOLMAN, Justice.
Plaintiff, a real estate broker, brought an action for damages for breach of a broker's contract. The contract had a provision for attorney's fees should the broker be successful in an action upon the contract. Defendant filed both an answer denying breach of contract and a counterclaim requesting attorney's fees. Two days prior to trial plaintiff requested and was granted a judgment of voluntary non-suit. The trial court denied defendant attorney's fees and defendant appealed.
The sole issue on appeal is whether under such circumstances defendant is entitled to attorney's fees under the provisions of ORS 20.096. The parties stipulated that should it be determined upon appeal that defendant was entitled to attorney's fees in the trial court a reasonable sum to be allowed therefor would be $1,801.90. ORS 20.096(1) provides:
"In any action or suit on a contract, where such contract specifically provides that attorney fees and costs incurred to enforce the provisions of the contract shall be awarded to one of the parties, the prevailing party, whether he is the party specified in the contract or not, at trial or on appeal, shall be entitled to reasonable attorney fees in addition to costs and necessary disbursements."
Subsection (3) of the statute defines a "prevailing party" as "the party in whose favor final judgment or decree is rendered."
The trial court denied attorney's fees because it did not believe defendant qualified as the "prevailing party." However, defendant was the prevailing party because a voluntary nonsuit terminates the case in a defendant's favor. Even though the termination was without prejudice and plaintiff could file another case upon the same cause of action, these facts did not prevent defendant from being the party in whose favor the judgment was rendered in that particular case. Ferrell v. Leach, 268 Or. 299, 300, 520 P.2d 357 (1974), and Sackett v. Mitchell, 264 Or. 396, 398, 505 P.2d 1136 (1973) so held. In both Ferrell and Sackett the voluntary nonsuit was taken during the presentation of the plaintiff's case in chief; however, this difference in the chronology of events between those cases and the instant case is irrelevant to the issue at hand because the result is the same insofar as who prevails. In both situations plaintiff may file another action upon the same cause. The term "prevailing party" as used in the statute refers back to "any action * * * on a contract." The present case is an action on a contract which terminated in defendant's favor. The statute does not require, as plaintiff contends, that one entitled to attorney's fees must prevail upon the ultimate determination of the cause of action.
Plaintiff also contends that defendant is not entitled to attorney's fees because ORS 20.096 provides for such fees "at trial or on appeal" and that "at trial" means a trial or a hearing upon an issue of fact. Plaintiff relies upon State v. Pacific Live Stock Co., 93 Or. 196, 182 P. 828 (1919), and Warm Springs Irr. Dist. v. Pacific L. Co., 89 Or. 19, 173 P. 265 (1918). In both of these cases the issue was the intention of the legislature in the use of the word "trial." As indicated in *239 State v. Pacific Live Stock Co., supra, the context in which the term is used has much to do with the meaning which was intended. In the cases upon which plaintiff relies, the word "trial" was interpreted to mean a hearing upon issues of fact. It is our conclusion that in enacting the statute here under consideration, the legislature intended the use of the words "at trial" to distinguish between proceedings at the trial court level as compared with those on appeal and that it did not intend the use of the term to categorize judicial proceedings upon a determination of whether or not a hearing on the merits of a claim had begun.
Plaintiff next contends that defendant was not entitled to attorney's fees because defendant did not properly plead and prove such fees. However, defendant did plead a counterclaim for attorney's fees. When the nonsuit was granted, plaintiff requested attorney's fees in its costs bill, which request was properly denied because plaintiff's right to attorney's fees arose out of the contract and the terms of ORS 20.096. Plaintiff then filed a motion to strike defendant's counterclaim for fees. The trial court allowed plaintiff's motion on the basis that no right existed to attorney's fees for defendant at the time the counterclaim was filed and that its filing was therefore frivolous. Defendant then filed a petition for attorney's fees. A hearing was held wherein the court denied the petition. The stipulation hereinbefore mentioned was entered into concerning the proper amount to be allowed if, upon appeal, it was concluded that defendant was entitled to attorney's fees.
Certainly, defendant made it known that he was requesting attorney's fees, and the court ultimately ruled on the merits of his request. We are not going to quibble about the form in which defendant made his original request. Whether a counterclaim was or was not the proper technical method by which to request attorney's fees, it accomplished the principal purpose of a pleading, which is to inform the pleader's adversary of the pleader's position. In any event, if a request for fees can be made only after defendant prevails, as the trial court held, a petition is a proper way to present the matter as long as defendant has informed his adversary at the commencement of the case that fees will be requested if defendant is ultimately successful in the defense of that action.
Defendant also contends that it is entitled to attorney's fees upon appeal. The contract contained the following provision:
"In case of suit or action on this contract, Owner agrees to pay in addition to the above specified fee such sum as the Court may adjudge reasonable as attorney's fees."
This court has construed ORS 20.096 to award attorney's fees on appeal only if the contract specifically provides for their allowance on appeal. National General Theatres v. Bolger, 266 Or. 584, 590-91, 514 P.2d 344 (1973); McMillan v. Golden, 262 Or. 317, 321, 497 P.2d 1166 (1972). As a result, defendant is not entitled to attorney's fees upon appeal because the contract had only a general provision for attorney's fees.
The judgment of the trial court is reversed and the case is remanded for the purpose of entering a judgment for attorney's fees for defendant at the trial level in accordance with the amount agreed upon in the parties' stipulation.
