xsl-list
[Top] [All Lists]

Re: the "~" operator (was Re: [xsl] Add id to next element)

2022-05-19 22:03:31
On Fri, 2022-05-20 at 02:05 +0000, Graydon graydon(_at_)marost(_dot_)ca wrote:

I'm not sure I want that ~ operator MORE than I want to be able to
stuff
XPath expressions into macros,

In XSLT you can already write,

<!DOCTYPE xsl:stylesheet [
  <!ENTITY pattern " '\d{2,5}' ">
  <!ENTITY firstToken "(tokenize(., &pattern;) [1])">
]>
<xsl:stylesheet>
  <xsl:sequence select="//extension ! &firstToken;" />
</xsl:stylesheet>

but syntactic sugar for lambda expressions with arguments and closures,
and the chaining of xsl instructions in the blog post, would be very
interesting.

  tokenize(., &pattern;) ! λx { if ($x castable as xs:number) then
number($x) else 17 }



-- 
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
--~----------------------------------------------------------------
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
--~--


<Prev in Thread] Current Thread [Next in Thread>