Question: I noticed that when I set my Rails app to production it created a folder in my application called `RAILS_ENV=production` I've kinda rolled back now and not pushing to production. Am I free to delete this folder?

Answer: 
> 
> the following XSLT segment:
> 
> 
> 

```
<xsl:template match="p|b|i">
    <xsl:copy>
        <xsl:apply-templates/>
    </xsl:copy>
</xsl:template>

```

> 
> will actually generate the output like
> 
> 
> (18221895) 
> 
> 
> But I want 
> 
> 
> (1822-1895)
> 
> 
> 

**I cannot repro the problem.**

**With this XML document** (corrected in order to be well-formed):

```
<!DOCTYPE p [
 <!ENTITY ndash   "&#8211;">
]>
<p>
    <media id="pc300220-scpwr.gif" print-rights="no"
    rights="licensed" type="photo">
        <title>Louis Pasteur</title>
        <credit>Granger Collection</credit>
    </media>
    <b>Louis</b>
    <pronunciation>
        <word-term>
            <b>Pasteur</b>
        </word-term>
    </pronunciation> (1822&ndash;1895) was a French chemist. He made major contributions         to chemistry, medicine, and industry. His work has greatly benefited people. For         example, he discovered that diseases spread through
    <definition>
        <word-term>bacteria </word-term>
        <word-definition>tiny living things</word-definition>
    </definition>. This discovery has saved many millions of lives.
</p>

```

**and when this transformation is applied**:

```
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="p|b|i">
        <xsl:copy>
            <xsl:apply-templates/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

```

**the result is**:

```
    Louis Pasteur
    Granger Collection

<b>Louis</b>

        <b>Pasteur</b>

 (1822–1895) was a French chemist. He made major contributions         to chemistry, medicine, and industry. His work has greatly benefited people. For         example, he discovered that diseases spread through

    bacteria 
    tiny living things
. This discovery has saved many millions of lives.

```
Dimitre was correct in saying that there is no problem in the XSLT code. However, this is not an XSLT issue, this is a parsing issue.

Your document contains entity `&ndash;`, which is not a predefined XML entity. So a parser is not able to replace its value if it doesn't know the definition of that entity. This means that your XML is valid **if** it has an access to a DTD that has a definition for the entity `&ndash;`. That DTD might be embedded internally in the XML document (like in Dimitre's example) or it might be defined in an external DTD that is referred in the XML document. Your code didn't have any DTD definitions or references, but I believe you copy-pasted only a snippet from your code so DTD was accidentally left out.

### So, what is actually causing your problem

Even if the entity definition is available, it still doesn't mean that the parser neccessarily does an entity value replacement.

XML 1.0 recommendation states: (ref: <http://www.w3.org/TR/xml/#wf-entdeclared> )

> 
> Note that non-validating processors
>  are not obligated to read and process
>  entity declarations occurring in
>  parameter entities or in the external
>  subset; for such documents, the rule
>  that an entity must be declared is a
>  well-formedness constraint only if
>  standalone='yes'.
> 
> 
> 

and: (ref: <http://www.w3.org/TR/xml/#include-if-valid> )

> 
> If the entity is external, and the
>  processor is not attempting to
>  validate the XML document, the
>  processor MAY, but need not, include
>  the entity's replacement text. If a
>  non-validating processor does not
>  include the replacement text, it MUST
>  inform the application that it
>  recognized, but did not read, the
>  entity.
> 
> 
> 

It's not clear is your *whole document* actually well-formed or not, but your parser did parse your document and it seems that it removed the entity reference without including the replacement text. Therefore `1822&ndash;1895` is interpreted as `18221895`. The XSLT processor works on the parsed data model and if it doesn't contain that dash character, the XSLT processor can't copy it to the resulting XML.

I suggest that you make sure that the parser has access to the DTD where all the entities are defined and possibly also set your parser to a validating mode.