You have escaped the text inside of your Text element so that the XML parser
will treat it like text, therefore there are no <inserted> or <deleted>
elements, only a block of text.
Why are you escaping the contents of the <Text> element?
Also, your output is not what I would expect. I would expect to see the
"<inserted>" make it into the output. Can you show a complete template
that outputs as you have described?
Josh
-----Original Message-----
From: Andrew Madigan [mailto:Andrew_Madigan(_at_)skillsoft(_dot_)com]
Sent: Wednesday, June 16, 2004 12:47 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] xml nodes with spaces (at start, end, or just spaces) not
showing correctly with xsl
Hi,
I am trying to display xml that has formatting and also has a form of
'track changes' in a browser using xsl.
The 'track changes' is implemented by using <inserted> and <deleted>
tags to identify changes (these are escaped with < > etc. in the
XML).
I want to display the latest version of the content so I show insertions
and do not show deletions.
Sample XML (snippet):
<Text>The<inserted> </inserted>quick<deleted>
</deleted> brown fox<inserted>
</inserted>jumped<inserted> </inserted>over the
lazy<deleted> </deleted> dog.</Text>
....which without the escaping becomes:
<Text>The<inserted> </inserted>quick<deleted> </deleted> brown
fox<inserted> </inserted>jumped<inserted> </inserted>over the
lazy<deleted> </deleted> dog.</Text>
So I am trying to get this to show as "The quick brown fox jumped over
the lazy dog."
Sample XSL 1 (snippet):
<xsl:template match="deleted"/>
<xsl:template match="inserted">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="br">
<br/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="i">
<i>
<xsl:apply-templates/>
</i>
</xsl:template>
<xsl:template match="b">
<b>
<xsl:apply-templates/>
</b>
</xsl:template>
Sample XML 2 (snippet):
<xsl:template match="deleted"/>
<xsl:template match="inserted">
<xsl:copy-of-select='.'/>
</xsl:template>
<xsl:template match="br">
<br/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="i">
<i>
<xsl:apply-templates/>
</i>
</xsl:template>
<xsl:template match="b">
<b>
<xsl:apply-templates/>
</b>
</xsl:template>
I have tried both of these solutions and neither work. I need to be able
to have formatting inside the insertions - hence the attempt to use
<xsl:apply-templates/>.
The output I am getting is "Thequick brown foxjumpedover the lazy dog."
- as though the spaces were never inserted.
Thanks in advance for any help or suggestions.
Andy
--+------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--