[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Add element at the end of a variable group of

Subject: Re: Re: Add element at the end of a variable group of elements
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 3 Mar 2021 22:55:13 -0000
Re:  Re: Add element at the end of a variable group of
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@xxxxxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> On Wed, 2021-03-03 at 16:22 +0000, Charles O'Connor
> coconnor@xxxxxxxxxxxx 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...

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.