Re: [xsl] xml to svg graphs

Subject: Re: [xsl] xml to svg graphs
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 29 Jan 2026 23:31:11 -0000
On Thu, 29 Jan 2026 14:18:47 -0000
"Dave Pawson dave.pawson@xxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

>  <xsl:variable name="maxYLabelWd" select="$labelFontSize *
> $labelFontWd * max(for $a in (0 to $yAxisMarkCount) return
> string-length(
> if ($gra/ph/@stacked='percentage') then
> concat(m:Round(($yAxisMin + $a * $yAxisStep) * 100, $yAxisStep), '% ')
> else
> string(m:Round($yAxisMin + $a * $yAxisStep, $yAxisStep))
> )
> + (if ($gra/ph/@yAxisType='log') then 2 else 0)
> )"/>  
> 
> with (saxon 9) error
> Error on line 132 of msgr2svg.xsl:
>   XPTY0004: Required item type of second operand of 'to' is
> xs:integer; supplied value has
>   item type xs:double

Either declare yAxisMarkCoiunt as an integer or turn it into an integer.

To make it an integer add as="xs:integer" on the cal:variable element
defining it.
To convert it, use xs:integer($yAxisMarkCount) or $yAxisMarkCount cast
as xs:integer.

liam

-- 
Liam Quin: Delightful Computing - Training and Consultancy in
XSLT / XML Markup / Typography / CSS / Accessibility / and more...
Outreach for the GNU Image Manipulation Program
Vintage art digital files - fromoldbooks.org

Current Thread