Subject: Re: [xsl] XSLT 3.1 that keeps both Saxon EE and HE happy and tokenizes an attribute From: "Michael Kay michaelkay90@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 26 Sep 2024 09:23:21 -0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT 3.1 that keeps both , Liam R. E. Quin liam | Thread | Re: [xsl] XSLT 3.1 that keeps both , Robert Stuart bobstu |
Re: [xsl] XSLT 3.1 that keeps both , Liam R. E. Quin liam | Date | Re: [xsl] XSLT 3.1 that keeps both , Robert Stuart bobstu |
Month |