[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: escaping ampersands in replace function

Subject: Re: escaping ampersands in replace function
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 04 Sep 2007 20:33:26 +0200
Re:  escaping ampersands in replace function
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.