[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: Mario Madunic <hajduk@xxxxxxxx>
Date: Tue, 4 Sep 2007 10:08:49 -0700
Re:  escaping ampersands in replace function
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.

Quoting Mario Madunic <hajduk@xxxxxxxx>:

> Not all fragments will contain an &amp;. Franklin &amp; Jefferson will still
> be
> output as Franklin &amp; Jefferson and not Franklin and Jefferson
> 
> here is an XML fragment
> 
> <bodyContent>
> <p>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</p>
> <p>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.</p>
> </bodyContent>
> 
> the XSLT fragment
> 
> <xsl:variable name="l_TempBodyContent">
> <xsl:for-each select="body/node()">
> <xsl:choose>
> <xsl:when test="position() = 1"><xsl:value-of select="." /></xsl:when>
> <xsl:otherwise><xsl:value-of select="concat(' ', .)" /></xsl:otherwise>
> </xsl:choose>
> </xsl:for-each>
> </xsl:variable>
> 
> <xsl:variable name="l_BodyContent" select="replace($l_TempBodyContent,
> '&amp;',
> 'and')" />
> 
> Marijan (Mario) Madunic
> 
> Quoting David Carlisle <davidc@xxxxxxxxx>:
> 
> > 
> > 
> > > replace($l_TempString,'&','and')
> > > get an error message stating the & must be followed by an entity
> > > reference
> > 
> > yes, that's not a well formed XML fragment.
> > 
> > 
> > > replace($l_TempString,'&amp;','and') and
> > replace($l_TempString,'&amp;amp;','and')
> > > the amp is not replaced.
> > 
> > so presumably $l_TempString does not contain a substring that matches
> > either "&" or "&amp;".
> > 
> > so what is $l_TempString  ? ie what does <xsl:value-of
> > select="$l_TempString"/> produce.
> > 
> > It's always helpful to post a complete xml input and complet xslt
> > stylesheet (in this case, each only need be two or three lines long,
> > 
> > 
> > David
> > 
> > ________________________________________________________________________
> > The Numerical Algorithms Group Ltd is a company registered in England
> > and Wales with company number 1249803. The registered office is:
> > Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
> > 
> > This e-mail has been scanned for all viruses by Star. The service is
> > powered by MessageLabs. 
> > ________________________________________________________________________

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-2013 All Rights Reserved.