Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] escaping ampersands in replace function

From: Abel Braaksma <abel.online@--------->
To:
Date: 9/4/2007 7:01:00 PM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent