This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
How to preserve a node's value containing escaped text (' and " in particular)?
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: How to preserve a node's value containing escaped text (' and " in particular)?
- From: Brian Young <Brian dot Young at sas dot com>
- Date: Fri, 26 May 2000 16:38:57 -0400
- Reply-To: xsl-list at mulberrytech dot com
Hello,
I'm new to the list, and I apologize in advance for any newcomer mistakes. A few of the problems I was having were answered by reading the FAQ. One remained, however.
Given the following input XML:
<InputText>< > & ' "</InputText>
And the following XSL:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:template match="InputText">
<OutputText>
<xsl:value-of select="." />
</OutputText>
</xsl:template>
</xsl:stylesheet>
I was hoping to get the following output:
<OutputText>< > & ' "</OutputText>
Instead, I get:
<OutputText>< > & ' "</OutputText>
Is there a way to keep ' and " preserved? I also tried select="text()" as well, but no luck. Of course, this is all part of a much bigger transformation, but in this instance I need to preserve the text contained within the InputText element. I'm going from XML to XML, by the way. I'm using XT and XP from James Clark's page. Will <xsl:copy> or somesuch do the trick? I do not, however, wish to copy the element, just the text, as I'll be adding attributes to the element. I don't want to copy children either.
If this is answered in the FAQ but I just didn't see it for what it is then I apologize.
Thanks,
Brian Young
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list