XML : How to substitute element nested in a text with unicode character

Into the following example I have a nested empty element that has to be substituted by a space character:   on the output document.

This is the input xml file:

  <?xml version="1.0" encoding="UTF-8"?>  <catalog>     <cd>       <title>Empire<s/>Burlesque</title>       <artist>Bob<s/>Dylan</artist>     </cd>     <cd>       <title>Scareface</title>       <artist>Al<s/>Pacino</artist>       </cd>  </catalog>    

This is the xsl file:

  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">      <xsl:output method="xml"/>      <xsl:template match="/">          <root>              <xsl:apply-templates select="/catalog"/>          </root>      </xsl:template>      <xsl:template match="catalog">          <xsl:for-each select="cd">              <title>                  <xsl:value-of select="title"/>              </title>              <artist>                  <xsl:value-of select="artist"/>              </artist>          </xsl:for-each>      </xsl:template>  </xsl:stylesheet>    

What I want is output like this:

  <root>      <title>Empire Burlesque</title>      <artist>Bob Dylan</artist>      <title>Scareface</title>      <artist>Al Pacino</artist>  </root>    

Please note the spaces between Empire and Burlesque. Currently the output represents the names without the space character in-between. Any help would be much appreciated.

No comments:

Post a Comment