Project

Profile

Help

Feature #4065

closed

Saxon-JS: Allow AVTs in ixsl:schedule-action/wait

Added by Gerrit Imsieke over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT export
Sprint/Milestone:
-
Start date:
2018-12-11
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

I’m currently experimenting with visualizing a transformation using Saxon-JS. To this end, I injected code into an existing transformation that calls, by means of ixsl:schedule-action, a template that will attach classes to preformatted renderings of the source and of the result document. Portions of the source document and of the result tree are supposed to change their background colours as the transformation proceeds. This works sufficiently well already, but I want to be able to animate, for example, individual current-group()s in an xsl:for-each-group, one at a time. It is therefore desirable to be able to use attribute value templates for @wait. I already experimented with calculated values by modifying the SEF.

This seems to work:

  <let line="162" var="vv:v0" as="xs:integer" slot="3" eval="13">
   <arith op="*" calc="i*i">
    <varRef name="pos1" slot="1"/>
    <int val="4000"/>
   </arith>
   <forEachGroup line="153" algorithm="ending">
  ……
  <ifCall line="163" name="Q{http://saxonica.com/ns/interactiveXSLT}schedule-action" type="item()*">
   <arith op="+" calc="i+i">
      <varRef name="vv:v0" slot="3"/>
      <arith op="*" calc="i*i">
       <varRef name="pos2" slot="4"/>
       <int val="1000"/>
      </arith>
     </arith>
   <empty/>
   <callT line="164" name="add-highlights" bSlot="1">
    <withParam name="Q{}highlights" flags="c" as="map(xs:string, xs:string+)">
   ……
  </let>

stemming from

  <ixsl:schedule-action wait="{$pos1 * 4000 + $pos2 * 1000}">
  <xsl:call-template name="add-highlights">
    <xsl:with-param name="highlights"
      select="map{concat('grouping-population', string($pos1), '_', string($pos2)): $population2}"/>

(the XSLT code doesn’t contain AVTs right now, but this is how I’d use it).

After adapting the checksum, the animation unfolds as scheduled. Therefore I ask whether you are inclined to allow/process/export AVTs on ixsl:schedule-action/@wait in the next release of Saxon-JS.

Ah, did I mention that I’d need it before XML Prague? Anyway, if it’s not feasible or prioritized, I will continue to manually patch the resulting SEF for the demo.

Actions #1

Updated by Debbie Lockett over 5 years ago

Thanks for the suggestion, Gerrit. This seems like a good idea!

Saxon-JS 2.0 (where most major development work is currently happening) is unlikely to be out before XML Prague. But we should be able to get a Saxon-JS 1.x maintenance release out for you with this feature before then.

The feature will also require updates for compiling the ixsl:schedule-action instruction in Saxon-EE, so probably just in Saxon 9.9 (is that the version you're using to produce the SEF?)

Otherwise - well done for getting a work around working! Your demo certainly sounds fun, we look forward to seeing it!

Actions #2

Updated by Gerrit Imsieke over 5 years ago

I’m currently using the EE version that is bundled with oXygen 20.1, but I can purchase an EE license key so that I be able to use the standalone product.

Actions #3

Updated by Debbie Lockett over 5 years ago

In fact, we shouldn't need code changes after all!

The ixsl:schedule-action/@wait attribute allows an expression, which must evaluate to an integer, but does not need to be an integer literal. So you should be able to supply a variable in the call i.e.:

<xsl:variable name="delay" select="$pos1 * 4000 + $pos2 * 1000"/>
<ixsl:schedule-action wait="$delay">
  <xsl:call-template name="add-highlights">
    <xsl:with-param name="highlights"
      select="map{concat('grouping-population', string($pos1), '_', string($pos2)): $population2}"/>
Actions #4

Updated by Gerrit Imsieke over 5 years ago

D’oh!

It is even simpler. I don’t have to use a variable, I only need to omit the curly braces. I wasn’t aware that @wait already holds an expression. It’s all in the documentation though!

About to close this one…

Actions #5

Updated by Gerrit Imsieke over 5 years ago

(which I can’t do with my user privileges, apparently)

Actions #6

Updated by Michael Kay over 5 years ago

  • Status changed from New to Closed

Please register to edit this issue

Also available in: Atom PDF