Re: [xsl] XSLT 3.1 that keeps both Saxon EE and HE happy and tokenizes an attribute

Subject: Re: [xsl] XSLT 3.1 that keeps both Saxon EE and HE happy and tokenizes an attribute
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Sep 2024 04:32:49 -0000
On Thu, 2024-09-26 at 04:21 +0000, Robert Stuart bobstuart@xxxxxxx
wrote:
>
> tokenize(./@someAttribute) works great in HE but bombs in EE with A
> sequence of more than one item is not allowed as the first argument
> of fn:tokenize()

Right. This is because the schema gives @someAttribute a type
annotation saying it's a list, so it becomes a sequence.

you could use e.g.
   if (count(@someAttribute) gt 1) then @someAttribute else
tokenize(@someAttribute)

or have a template that only matches the attribute if it has a type
annotation, and one tha tmatches if it doesn't and tokenizes it, and
use apply-templates.

<xsl:template match=".[. instance of my:listType]">....

Or that's what i think late at night anyway :-)

best

liam

--
Liam Quin,B https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org

Current Thread