[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Escaping Characters in replace()
This is a basic question, sorry for wasting your time. But, I'm having trouble escaping quotes. Here's what my input looks like: <unittitle>"The Atomic Bomb Foreshadowed: 1700 Years Ago".</unittitle> Here's my XSLT (2.0): <xsl:template match="unittitle/text()"> <xsl:value-of select="normalize-space(replace(., '""..', '..""'))"/> </xsl:template> I'd like to search for all occurrences of ". and replace them with ." I don't think I can use "e; because the original input has the literal quote and note an entity reference. I've been searching online and have tried to escape with backslash, double backslash, double quote, double period, but can't get it working. I also tried variables, as below, but my processor (Saxon-EE 9.4.0.4) threw an error, expecting a digit after the dollar sign. <xsl:template match="unittitle/text()"> <xsl:variable name="quote">"</xsl:variable> <xsl:variable name="period">.</xsl:variable> <xsl:value-of select="normalize-space(replace(., '$quote$period', '$period$quote'))"/> </xsl:template> This is basic, so should be simple. But I'm lost. Can someone please point me in the right direction? Thanks, Nathan
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|