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: "Robert Stuart bobstuart@xxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Sep 2024 18:18:22 -0000
LOL thatbs funny I did have someone on my team suggest that and said to
myself/them people like Michael and Liam would shame me if I did that.

So in your mind is the overhead of the sad turn a list back into a string and
tokenize it for EE not a bit deal maybe we go that way.

I was wondering if there is a bgenericb type instead of the actual schema
types since I have dozens of these list types. It would be nice to say
instance of blistb

The count suggestion I think might not quite work since sometimes I have one
token and I think the result of the tokenize is not a string and that works
better later in the stylesheet when merging sets.


> On Sep 26, 2024, at 05:23, Michael Kay michaelkay90@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> If you're not worried about the slight overhead, you could do
`tokenize(string(@attribute))`.
>
> Michael Kay
> Saxonica
>
>> On 26 Sep 2024, at 05:33, Liam R. E. Quin liam@xxxxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>>
>> 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, 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:  http://www.fromoldbooks.org

Current Thread