0

I have source xml like this (some nodes have text with character code, i.e. TAB):

<Root>
  <A>test&#x9;</A>
</Root>

and xslt like this:

 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <Result>
            <xsl:value-of select="Root/A/text()" disable-output-escaping = "yes"/>
        </Result>
    </xsl:template>
 </xsl:stylesheet>

When I apply xsl to source xml I got this:

<Result>test    </Result> <!-- "test" and tab-symbol -->

Can I change my xslt to get result text exactly same as source?

<Result>test&#x9;</Result>
  • 1
    Are you able to use an XSLT 2.0 processor? If so, you could make use of `xsl:character-map` to achieve this. – Tim C Jun 17 '17 at 07:58
  • Per Tim C's comment, see the [**Replacing and maintaining character entities through multiple transformations**](https://stackoverflow.com/questions/4169594) post. – Eiríkr Útlendi Jun 20 '17 at 19:29

0 Answers0