Subject: Re: [xsl] targeting the 'first' instance of the same element in variable structures From: "Piez, Wendell A. (Fed) wendell.piez@xxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 2 Jul 2024 21:33:16 -0000 |
Hello, Did anyone put up <xsl:template match="head[. Is /descendant::head[1]]"/> ? Apologies if I have forgotten the actual requirement -- Cheers, Wendell -----Original Message----- From: Liam R. E. Quin liam@xxxxxxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Sent: Tuesday, July 2, 2024 4:52 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] targeting the 'first' instance of the same element in variable structures On Tue, 2024-07-02 at 11:42 +0000, Jean-Paul Rehr rehrjb@xxxxxxxxx wrote: > > > > > > > for $div in $mydoc//body/div > > > return > > > 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, 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: http://www.fromoldbooks.org/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] targeting the 'first' ins, Liam R. E. Quin liam | Thread | Re: [xsl] targeting the 'first' ins, Martin Honnen martin |
Re: [xsl] targeting the 'first' ins, Liam R. E. Quin liam | Date | Re: [xsl] targeting the 'first' ins, Martin Honnen martin |
Month |