You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matthew Smith <ms...@windebt.com> on 2000/09/22 21:29:37 UTC

xsl:selecting the first matching element and no more

	Let's say I've got the following xml:
<language type="oo">c++</language>
<language type="scripting">javascript</language>
<someparent>
   <language type="scripting">php</language>
   <language type="oo">java</language>
   <language type="markup">html</language>
</someparent>
<language type="scripting">perl</language>
	And I want to apply templates to a language who's type equals some
variable, like this:
<xsl:apply-templates select="//language[@type=$thetype]" />
	But I only want to process one.. the first one in document.  I thought I
could select that with:
<xsl:apply-templates select="//language[@type=$thetype][1]" />
	But this isn't working.  How could I accomplish this?

Thanks,
Matt