NB also Liam's variable could be recast as a function, to be namespace-safe:
<xsl:function name="z:is-early" as="xs:boolean">
<xsl:param name="who" as="element()"/>
<xsl:sequence
select="exists($who/(self::bar|self::foo|self::mercury|self::venus"/>
</xsl:function>
<xsl:template match="*[z:is-early(.)][last()]" priority="10">
<xsl:next-match/> <!--* built-in template copies the element *-->
<moon>Now with more craters!</moon>
</xsl:template>
Mind you, to drop a moon in where there is no planet at all would still
need a little 'pull' logic.
This is where a schema is quite useful, since a required element in a
sequence can provide a hook to hang things on.
Cheers, Wendell
On Wed, Mar 3, 2021 at 2:59 PM Liam R. E. Quin liam(_at_)fromoldbooks(_dot_)org
<
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
On Wed, 2021-03-03 at 16:22 +0000, Charles O'Connor
coconnor(_at_)ariessys(_dot_)com wrote:
Liam, I will continue to annoy my IT/Engineering group to upgrade to
a 3.0 processor. I suspect I'll get the same response.
Haha! note that i included an XSLT 2 approach that may be slightly
easier to maintain than some of the others.
And i continue to offer XSLT 3 training for XSLT 2 people! :)
--
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
--
...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--