Return-Path: Mailing-List: contact cocoon-users-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-users@xml.apache.org Received: (qmail 91655 invoked from network); 22 Sep 2000 21:43:55 -0000 Received: from dengw01.galileo.com (12.17.202.46) by locus.apache.org with SMTP; 22 Sep 2000 21:43:55 -0000 Received: from mfil.terminal (mfil@localhost) by dengw01.galileo.com with SMTP id PAA10351 for ; Fri, 22 Sep 2000 15:40:44 -0600 (MDT) Received: from denexc05.galileo.com (denexc05.galileo.com [10.194.0.55]) by dengw01.galileo.com with ESMTP id PAA10190 for ; Fri, 22 Sep 2000 15:40:17 -0600 (MDT) Received: by denexc05.galileo.com with Internet Mail Service (5.5.2650.21) id ; Fri, 22 Sep 2000 15:41:21 -0600 Message-ID: <420C28CAA337D311B98F000024C83E36059F3774@denexc06.galileo.com> From: "Weakliem, Gordon" To: cocoon-users@xml.apache.org Subject: RE: selecting the first matching element and no more Date: Fri, 22 Sep 2000 15:40:31 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N True, I hadn't thought of that. I take it then that you want to evaluate all nodes of a certain type at position()=1, as opposed to evaluating the first node of @type=$sometype? Off the top of my head, I'd say you'd have to call a named template selecting all the nodes, and then evaluate the first node from that set, like in the 2nd example I had. I can't think of an expression that would do it all at once. I'm no expert though, maybe the XSL-list (http://www.mulberrytech.com/xsl/xsl-list) people would have a ready answer. > -----Original Message----- > From: Matthew Smith [mailto:msmith@windebt.com] > Sent: Friday, September 22, 2000 2:57 PM > To: cocoon-users@xml.apache.org > Subject: RE: selecting the first matching element and no more > > > Wouldn't select multiple nodes if you had: > > c++ > > > java > > Those both have position 1 and the type oo. I'm trying > to select only one > element, no matter how many match in the entire document. > > Thanks, > Matt > > -----Original Message----- > From: Weakliem, Gordon [mailto:Gordon.Weakliem@Den.Galileo.com] > Sent: Friday, September 22, 2000 3:20 PM > To: cocoon-users@xml.apache.org > Subject: RE: selecting the first matching element and no more > > > Looks like you're trying to do select="//language[@type=$thetype and position() = 1]" />. > This selects all > the elements with matching type that have position 1 at their > level in the > doc. In your example, for type="oo", that would be c++, for > "scripting" > it's "php". If you want to select a set, then evaluate the > first one in > that set (i.e. "scripting" - "javascript"), that's different > problem; I > think you'd have to use 2 steps: > > > select="//language[@type='$thetype']" /> > > > > > > > > Maybe there's a simpler way, my XPath's not the greatest. > > > -----Original Message----- > > From: Matthew Smith [mailto:msmith@windebt.com] > > Sent: Friday, September 22, 2000 1:30 PM > > To: Cocoon List (E-mail) > > Subject: xsl:selecting the first matching element and no more > > > > > > Let's say I've got the following xml: > > c++ > > javascript > > > > php > > java > > html > > > > perl > > And I want to apply templates to a language who's type > > equals some > > variable, like this: > > > > But I only want to process one.. the first one in > > document. I thought I > > could select that with: > > > > But this isn't working. How could I accomplish this? > > > > Thanks, > > Matt > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org > > For additional commands, e-mail: cocoon-users-help@xml.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org > For additional commands, e-mail: cocoon-users-help@xml.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org > For additional commands, e-mail: cocoon-users-help@xml.apache.org >