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

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

Subject: Re: the "~" operator (was Re: Add id to next element)
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 20 May 2022 03:27:15 -0000
Re: the "~" operator (was Re:  Add id to next element)
On Fri, May 20, 2022 at 03:03:32AM -0000, Liam R. E. Quin
liam@xxxxxxxxxxxxxxxx scripsit:
> On Fri, 2022-05-20 at 02:05 +0000, Graydon graydon@xxxxxxxxx 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>

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
> interesting.
> 
>   tokenize(., &pattern;) ! N;x { if ($x castable as xs:number) then
> number($x) else 17 }

Agreed!

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

-- 
Graydon Saunders  | graydonish@xxxxxxxxx
CC&s oferC)ode, C0isses swC! mC&g.
-- Deor  ("That passed, so may this.")

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.