qtspecs icon indicating copy to clipboard operation
qtspecs copied to clipboard

xsl:sequence: @as

Open liamquin opened this issue 4 years ago • 5 comments

I'd like to see@as on xsl:sequence. That way i can write, e.g.

<xsl:function name="dc:slice-count" as="xs:integer">
  <xsl:param name="toast" as="element(toast)" />
  <xsl:for-each select="$toast" as="xs:integer">
    <xsl:sequence select="@cooked-slices + @raw-slices"  as="xs:integer" />
  </xsl:for-each>
</xsl:function>

It would be an error for the for-each to have other than exactly one integer as its result, and the same for the @sequence. In this simple example there's not much scope for that to happen of course,

Maybe on anything with a select attribute?

Parenthetically, a context-item attribute on xsl:sequence would obviate the XSLT1-ish xsl:for-each there, although $toast/(@a, @b) => sum() would work as well and be XSLT 3-ish.

liamquin avatar Jan 13 '21 00:01 liamquin