Why does the XTSE1015 Error occur when sorting XML document
I'm looking for some help with an XSL error. It's called XTSE1015 which stands for "An xsl:sort element with a select attribute must be empty". It happens when i try to output file to xml or text. Software such as Oxygen XML Editor or event Notepad++ show this error. I can't find any solution to this, well except not using sort but that is not a proper solution. Somebody stumbled upon this problem maybe and has some advice or something?
<xsl:variable name="strName">
<xsl:for-each select="Samochody/Model/Nazwa">
<xsl:sort select="string-length(.)" data-type="number">
<xsl:value-of select="."/>
</xsl:sort>
</xsl:for-each>
</xsl:variable>
Solution 1:
The <xsl:sort... />
element is not allowed to have any children. Hence the error. See, for example, here at Tutorialspoint.
So, to make it work, change your code to
<xsl:variable name="strName">
<xsl:for-each select="Samochody/Model/Nazwa">
<xsl:sort select="string-length(.)" data-type="number" />
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:variable>