Oxygen XML Editor
 
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] escaping ampersands in replace function


Subject: Re: [xsl] escaping ampersands in replace function
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 04 Sep 2007 20:33:26 +0200

Mario Madunic wrote:
Sorry here is the output I get

Tagged the World of Franklin &amp; Jefferson," display was created by general
Charles and Ray Eames fof the American Revolution centennial Administration, a
ernment organization Show will go on to Warsaw and London, then proceed to the
Museum of Modern Art in N.Y. Later it is to be exhibited in Chicago and San
Francisco.


<bodyContent> <p>Tagged the World of Franklin &amp; Jefferson," display was created by

<snip />

<xsl:variable name="l_TempBodyContent">
<xsl:for-each select="body/node()">

<snip />

What you are seeing is the output fromt he default template for any text nodes. Your xsl:for-each never selects anything. You can test this by explicitly telling the processor not to output anything when there's no match at all:


<xsl:template match="text()" />

Add that to your stylesheet. If you still get your output, you'll have to try a more concise example and post a complete stylesheet here so we can help you further. The following works for me:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:variable name="mytext">Text &amp; more text</xsl:variable>
<xsl:template match="/">
<xsl:value-of select="replace($mytext, '&amp;', 'and')" />
</xsl:template>


</xsl:stylesheet>

it outputs:

Text and more text


As you can see, no &amp;. Try it with your processor, see if it does the same... Narrowing down the problem with a tiny example that illustrates is, usually resolves the problem as well ;)


Cheers,
-- Abel Braaksma


Current Thread
 
© 2002-2008 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy
This website was created & generated with <oXygen/> XML Editor