RE: AW: p.wrap and attributes

Hi Denis,

Right,

You would put your step declaration in a library

<p:library version="3.0" 
    xmlns:p="http://www.w3.org/ns/xproc"
    xmlns:c="http://www.w3.org/ns/xproc-step"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:fn="http://www.w3.org/2005/xpath-functions"
    xmlns:ox="your-namespace"
    >
<p:declare-step name="report-status" type="ox:report-status">
       <p:input port="source"/>
       <p:output port="result"/>
....

And where you want to use your step, you need to import the library file

    <p:import href="your-library.xpl"/>

Best regards,

Geert Bormans

-----Original Message-----
From: denis.maier@unibe.ch <denis.maier@unibe.ch> 
Sent: Tuesday, 14 January 2025 10:19
To: wendell.piez@nist.gov; xproc-dev@w3.org
Subject: AW: AW: p.wrap and attributes

Thanks,  Wendell. I guess you can also put your own steps into their own
files, thus making them reusable?

> -----Ursprüngliche Nachricht-----
> Von: Piez, Wendell A. (Fed) <wendell.piez@nist.gov>
> Gesendet: Montag, 13. Januar 2025 20:24
> An: XProc Dev <xproc-dev@w3.org>
> Betreff: FW: AW: p.wrap and attributes
> 
> Once again I fail to reply-all! This was intended for Denis -
> 
> Regards, Wendell
> 
> -----Original Message-----
> From: Piez, Wendell A. (Fed)
> Sent: Monday, January 13, 2025 10:58 AM
> To: denis.maier@unibe.ch
> Subject: RE: AW: p.wrap and attributes
> 
> Denis,
> 
> Here is a local step declaration in a pipeline, which is then used 
> several times. It has only p:identity but it could easily be a call to 
> your XSLT, or a sequence of XProc steps instead or along with p:xslt.
> 
> Placing after the prologue (ports and options) and before the first step:
> 
> <p:declare-step name="report-status" type="ox:report-status">
>       <p:input port="source"/>
>       <p:output port="result"/>
>       <p:identity message="[CONTENT-TYPE_worksheet] [STATUS REPORT] 
> SEEING '{ p:document-property(.,'content-type') }' AT { p:document-
> property(.,'base-uri') }"/>
>    </p:declare-step>
> 
> To invoke the step:
> 
> <ox:report-status/>
> 
> (using your own namespace)
> 
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> u
> b.com%2Fwendellpiez%2Foscal-
> xproc3%2Fblob%2F2aea7c67a9196f35e1b5a233c91764c6deb0ce47%2Ftut
> orial%2Fworksheets%2FCONTENT-
> TYPE_worksheet.xpl%23L43&data=05%7C02%7Cdenis.maier%40unibe.ch%7
> Ca0782e7debc541eee7ff08dd3407e558%7Cd400387a212f43eaac7f77aa12
> d7977e%7C1%7C0%7C638723930744478768%7CUnknown%7CTWFpbGZs
> b3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIs
> IkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=TnKdPoCRR
> DefZz4ovMr3kC83S1IKg9MZqtaGWLBo0g8%3D&reserved=0
> 
> This has only p:identity (to produce a message). In your example you 
> could call p:xslt, or do something different or in addition.
> 
> The example or something like it should be in the public oscal-xproc3 
> repo in due course. (And I am noting that we need tutorial treatment 
> of how to go about declaring your own steps.)
> 
> Cheers, Wendell
> 
> -----Original Message-----
> From: denis.maier@unibe.ch <denis.maier@unibe.ch>
> Sent: Monday, January 13, 2025 6:59 AM
> To: Piez, Wendell A. (Fed) <wendell.piez@nist.gov>
> Subject: AW: AW: p.wrap and attributes
> 
> Yes, I guess that might be a good approach, but I fear I'm not yet 
> experienced enough to understand how that would work.
> 
> Best,
> Denis
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Piez, Wendell A. (Fed) <wendell.piez@nist.gov>
> > Gesendet: Freitag, 10. Januar 2025 16:38
> > An: XProc Dev <xproc-dev@w3.org>
> > Betreff: FW: AW: p.wrap and attributes
> >
> > Hello,
> >
> > Just restating the obvious here, but we can also make our own 
> > libraries for things we wish to handle 'declaratively' ... a 
> > grouping or wrapping operation, for example.
> >
> > If it is sufficiently generalized, your 'standard' is then already 
> > half baked (or at least proofing under a towel in a warm place).
> >
> > Cheers, Wendell
> >
> > -----Original Message-----
> > From: Norm Tovey-Walsh <ndw@nwalsh.com>
> > Sent: Thursday, January 9, 2025 10:19 AM
> > To: denis.maier@unibe.ch
> > Cc: gerrit.imsieke@le-tex.de; xproc-dev@w3.org
> > Subject: Re: AW: p.wrap and attributes
> >
> > <denis.maier@unibe.ch> writes:
> > > In a future xproc version, would it make sense to add something to 
> > > cover the
> > attributes here as well? Something like:
> >
> > Yes, perhaps. I tend (personally) to favor small, simple composable 
> > steps over large, complicated ones. After all, you've got access to 
> > XQuery or XSLT if you want to do something complicated. But in the 
> > steps that add elements, being able to specify attributes for those 
> > elements
> might make sense.
> >
> > Just in passing, I'll observe that the simpler-than-XSLT workaround is:
> >
> > <p:wrap match="xhtml:p[@class='reflist-item']"
> >         wrapper="ex:my-random-name"
> >         group-adjacent="@class"/>
> >
> > <p:set-attributes match="ex:may-random-name"
> >         .../>
> >
> > <p:rename match="ex:my-random-name"
> >           new-name="{{httpns}}div"/>
> >
> >                                         Be seeing you,
> >                                           norm
> >
> > --
> > Norm Tovey-Walsh <ndw@nwalsh.com>
> >
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fnorm
> >
> %2F&data=05%7C02%7Cdenis.maier%40unibe.ch%7Ca0782e7debc541eee7
> ff08dd34
> >
> 07e558%7Cd400387a212f43eaac7f77aa12d7977e%7C1%7C0%7C6387239
> 30744497398
> >
> %7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAu
> MDAwMCIsI
> >
> lAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sd
> ata=2N2
> > FsfLL1ddIrbHA6wHCTnk2hVh66xejfUg9NZdIu24%3D&reserved=0
> >
> %2F&data=05%7C02%7Cwendell.piez%40nist.gov%7C20dea83eda4f4109a7
> 2508dd3
> >
> 3c9b0e8%7C2ab5d82fd8fa4797a93e054655c61dec%7C0%7C0%7C638723
> 66353904438
> >
> 8%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjA
> uMDAwMCIs
> >
> IlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&s
> data=YD
> > ds7ioYcTCBqqyjMYokXrNqL22Lxeyaj%2FWSgwNITsg%3D&reserved=0
> > .tovey-
> >
> walsh.com%2F&data=05%7C02%7Cdenis.maier%40unibe.ch%7Ca753a5af0
> >
> dbf43c2e4a508dd318cf023%7Cd400387a212f43eaac7f77aa12d7977e%7C
> >
> 1%7C0%7C638721203594387267%7CUnknown%7CTWFpbGZsb3d8eyJFbX
> >
> B0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWF
> >
> pbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=6zO84wqd9id%2Br0qM
> > wV4o5DL%2BRlQmXF%2FSFNQMbvjbTUs%3D&reserved=0
> >
> > > Life is pain...anyone who tells you differently is selling 
> > > something.--Wesley (The Princess Bride)
> >
> 

Received on Tuesday, 14 January 2025 10:22:27 UTC