XSLT create element

Element Output

1. How to output an element

1.

How to output an element

Mike Kay

You can't generate markup in your output document by pretended it's text.

In this case the output you want is well-formed so "<IMG/> in your stylesheet will generate either <IMG/> or <IMG></IMG> in your output: if the output is XML then the two are equivalent so you shouldn't need to care about the difference. If the output isn't XML, but some other format that happens to use angle brackets, then XSLT isn't designed to do the job.

SAXON has a back-door mechanism to get round the problem if you need to (as you do sometimes, e.g. to generate <%...%> in ASP pages): you can write <xsl:tag>IMG/</xsl:tag>