[Top] [All Lists]

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

2022-05-19 22:27:22
On Fri, May 20, 2022 at 03:03:32AM -0000, Liam R. E. Quin
liam(_at_)fromoldbooks(_dot_)org scripsit:
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:sequence select="//extension ! &firstToken;" />

This is true, but pulling in general entities isn't general to XPath.
(Tough to do this with XQuery, for example.)

And it's not what one might call syntactically delightful, nor something
that might let one paramaterize the macro values, at least not short of
generating the transform you're going to run.

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

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


I still want %pattern that can be defined by some XPath mechanism.

Graydon Saunders  | graydonish(_at_)gmail(_dot_)com
Þæs oferéode, ðisses swá mæg.
-- Deor  ("That passed, so may this.")
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>