Conditional processing based on option

Hi,

A follow up on my question from yesterday regarding filesorting. As we haven't yet decided if we will sort the files within the pipeline or if we should normalize the file names during preprocessing, I've thought I could keep both ways in the pipeline, but use an option to determine which one is being use. I thought this should be straightforward, but this approach won't work.

<p:option name="sorted-files" select="'true'" />

<p:choose>
            <p:when test="$sorted-files = 'false'">
                <p:with-input select="//*:file => sort((), function($file) { analyze-string($file!@name, '[0-9]+')!descendant::*[not(*)]!(if (.
                    instance of element(fn:match)) then number(.) else string(.)) })"/>
            </p:when>
            <p:otherwise>
                <p:with-input select="//*:file"/>
            </p:otherwise>
        </p:choose>

But, apparently this does not work as p:with-input is not allowed under p:when and p:otherwise.

Is there a way to make this work?

Best,
Denis

Received on Friday, 22 November 2024 08:43:20 UTC