Re: [xsl] targeting the 'first' instance of the same element in variable structures

Subject: Re: [xsl] targeting the 'first' instance of the same element in variable structures
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 2 Jul 2024 20:51:36 -0000
On Tue, 2024-07-02 at 11:42 +0000, Jean-Paul Rehr rehrjb@xxxxxxxxx
wrote:
>
> > >
> > > for $div in $mydoc//body/div
> > > return
> > > B  B  B  transform:transform($div, $myxsl, ())
> > >

So, you want to match the first head element in each fragment, or the
first in $mydoc?

If the first in each fragment
    <xsl:template match="head[not(precding::head])" priority="10">
      this is first
and
    <xsl:template match="head[preceding::head]">
      not the first

If you want only the first in $Mydoc, that information isn't available
to XSLT when you pass just a fragment, so maybe add an XSLT parameter
to say, first=yes.

liam

--
Liam Quin,B https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org

Current Thread