Re: Pattern matching error in xsl:key

Michael Müller-Hillebrand <[email protected]>
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
Ihe,

This is a type casting error (see e.g. https://docs.basex.org/wiki/XQuery_Errors#Type_Errors ) and I am pretty sure you could make the life for Saxon easier if you would add some typing information.

In the first place I assume you want 

 <xsl:param name="source" select="'4.0'" as="xs:string"/>
 <xsl:param name="target" select="'4.1'" as="xs:string"/>

It may work without the as attribute, but the apostrophes should be there in any case.

- Michael

> Am 05.09.2020 um 11:43 schrieb Ihe Onwuka <[email protected]>:
> 
> <versionChanges  >
>   <changes from="4.0" to="4.1"> 
>       <rename from="me" to="you"/>
>   </changes>
> </versionChages>
> 
>    <xsl:param name="source" select="4.0"/>
>    <xsl:param name="target" select="4.1"/>
> 
>    <xsl:key name="changes" match="changes[@from eq $source and @to eq $target]/rename/*" use="@from"/>  
> 
> Warning at char 11 in xsl:key/@match on line 36 column 111 of translator.xsl:
>   XPTY0004  An error occurred matching pattern
>   {element(Q{mynamespace}changes)[((data(attribute::attribute(Q{}from))) eq
>   (atomizeSingleton($source))) and ((data(attribute::attribute(Q{}to))) eq
>   (atomizeSingleton($target)))]}:
> 
> 
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.