Rune Stilling wrote:
> Hi I'm trying to do a simple replace of the following form:
> <xsl:variable name="markup_topic_text" select="replace($markup_topic_text,
> '<', '<')"/>
> The parser complains though and won't do the replace. I have tried '\<',
> '<' but none of it works. One of the error messages I get is:
> SXXP0003: Error reported by XML parser: The value of attribute "select"
> associated with an
> element type "null" must not contain the '<' character.
> Isn't this possible?
You probably do not understand how XML represents characters - if
$markup_topic_text contains a '<' character then when serialised as an
XML document it will be encoded as <. Similarly your last argument
'<' *is* a less than character. Taking a wild guess at what you are
trying to do, you may want
replace($markup_topic_text, '<', '&lt;')
which will render $markup_topic_text as you would expect to see it in a
serialised document, i.e. 2<3 will appear as 2<3 _if_ you were to
view it through an XML aware application or as an HTML page, for example.
There are more elegant ways of doing this which will cope with other
problems such as the & character itself and what character encoding you
are dealing with.
You are likely to get better help from somewhere like the mulberrytech
XSLT list or an XML forum - your problem is not Saxon specific.
Melvaig Technologies Limited
voice: +44 (0) 1445 771363
email: tcn@... web: http://www.melvaig.co.uk
Registered in Scotland No 194737
5 Melvaig, Gairloch, Ross-shire IV21 2EA