I need to unescape xml characters from inside of XML nodes with help only XSLT transformation . I have <text><>and oyher possible characters</text>
and need to get it as valid formatted html when i placed it inside of body tag..
views:
637answers:
2
+2
A:
<xsl:template match="text">
<body>
<xsl:value-of select="." disable-output-escaping="yes" />
</body>
</xsl:template>
Note that the output is not guaranteed to be well-formed XML anymore.
Tomalak
2010-03-17 15:51:59
I would also note that disable-output-escaping is an optional serialization feature. It is not supported for instance by the XSLT processor used in Mozilla browsers like Firefox as those directly render the result tree and don't serialize it.
Martin Honnen
2010-03-17 17:28:38
A:
I haven't found an answer to this question. So I came to the conclusion that this is no way to do this. I found workaround for this problem, unescaping file on server side.
Artic
2010-03-19 12:58:27
Erm... What's wrong with my answer? This *is* the way to do what you ask for.
Tomalak
2010-03-23 08:10:15
Artic
2010-03-23 08:14:40
Which is *exactly* what "disabling the output escaping" means. If your input would be correctly escaped, which it isn't, you would have `<` and `>`, and these would turn to `<` and `>`. And then you would have ` `, which would turn to ` `. And that's a perfectly legal HTML escape sequence that does not need any further translation to " ". The fact that you have ` ` means your input is broken to begin with.
Tomalak
2010-03-23 08:35:15
And besides, you were not asking how to evaluate HTML named entities into actual characters, your question title is "How to unescape XML characters with help of XSLT?" and the only XML "special characters" are `<,>
Tomalak
2010-03-23 08:52:45