This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Passing through character entities intact


How do you take a character entity in an input document and pass it through
to the output document as an entity(i.e. without any change)?

What I am seeing is that the character entity gets substituted with the
character code for the entity instead of passing the entity through as a
character entity.

Example:

<mydocument>
  <text>
    Bought &mdash; Sold
  </text>
</mydocument>

Style sheet:

<xsl:template match="mydocument">
  <outputdocument>
    <xsl:value-of select="text"/>
  </outputdocument>
</xsl:template>

Output document: (\xxx are character codes of some sort)

<outputdocument>
  Bought \342\200\223 Sold
</outputdocument>

Intended output:

<outputdocument>
  Bought &mdash; Sold
</outputdocument>


We have tried several fixes with no success. Here they are in brief:

1. Include an xsl:output element with encoding set to UTF-8 and method set
to XML. This produced above results (minus indentation of output).

2. Include an xsl:output element with encoding set to ISO_8859-1. The mdash
appeared as '?' in the output.

3. Include DTD character entity definition in style sheet. No difference.

4. Include DTD character entity definition in output document. No
difference.

5. Use xsl:apply-templates instead of xsl:value-of. No difference.

6. Changed &mdash; to &amp;. This worked in xsl:output method of "html".

7. Added attribute 'disableOutputEscaping="yes"' to xsl:value-of. Of course
this does not work.


We are using Xalan for the XSL processing. 

Thank you in advance for any help you might have.

G. Angus McCollum

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]