I’m trying to supstring a string value with xslt.
<element><value>Value of element</value></element>
<element><xsl:value-of select="substring(element/value,1,40)"/></element>
This works great when there is no & in the value. In my case the value is
<element><value>Company ABC GmbH & Co.</value></element>
and the substring is not working and the value longer than 40.
I’m using xslt 2.0 and Saxon.
If the value is written in XML as
then the string you are processing in XPath/XSLT is
which means, for example, that substring(value, 18, 4) will give you the string “& Co”, which will be serialized as
"& Co"