Re: Viewports with regular steps

You could get tricky and generate the XSLT within the pipeline:

declare flow replace ($match as xs:string) inputs $in as document(),
$replacements as element()*, outputs $out as document() {

$in → select($match) ≫ $replacements
xslt([source="viewport.xsl",stylesheet="generate.xsl") ≫ $tranform
xslt([source=$in,collection=$replacements,stylesheet=$transform]) ≫ $out

}

Now we can do:

replace([$doc,$doc//section ! filter()],"//section")


On Wed, Mar 16, 2016 at 2:05 PM, Norman Walsh <ndw@nwalsh.com> wrote:
> Alex Miłowski <alex@milowski.com> writes:
>> I assert that this use of viewport:
>>
>>    $doc  → replace("//section") { $matched → filter() → $replacement }
>> ≫  $result
>>
>> can be done with this:
>>
>>    $doc//section ! filter() ≫ $replacements
>>    xslt([source=$doc,collection=$replacements,stylesheet="stitch.xsl"])
>> ≫  $result
>
> Oh, barf. Yes, I suppose it can, if you construct a different
> “stitch.xsl” for each possible match. Color me unsatisified.
>
>                                         Be seeing you,
>                                           norm
>
> --
> Norman Walsh
> Lead Engineer
> MarkLogic Corporation
> Phone: +1 512 761 6676
> www.marklogic.com



-- 
--Alex Miłowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics

Received on Wednesday, 16 March 2016 21:13:45 UTC