Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Apr 2005
    Thanked 0 Times in 0 Posts

    escape double quotes in result

    I'm using the following code to produce a js array, however parts of the result text can contain double quotes.. Is there an easy way to escape them??

    Example: say Artist is 'artist "name"'
    i want that to convert to 'artist \"name\"'

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    	<xsl:template match="/">
    	<textarea cols='25' rows='25'>
    var myData = [
    	<xsl:call-template name="records" />
    	<xsl:template name="records">
    		<xsl:for-each select="/*/*/dict[1]/dict">["<xsl:number value="position()" format="0001" />",<xsl:call-template name="songs" />],
    	<xsl:template name="songs">"<xsl:value-of select="child::*[preceding-sibling::* = 'Name']" />","<xsl:value-of select="child::*[preceding-sibling::* = 'Artist']" />","<xsl:value-of select="child::*[preceding-sibling::* = 'Total Time']"/>","<xsl:value-of select="child::*[preceding-sibling::* = 'Album']" />"</xsl:template>
    public string ConjunctionJunction(string words, string phrases, string clauses)
    return (String)(words + phrases + clauses);
    <--- Was I Helpfull? Let me know ---<

  2. #2
    Senior Coder
    Join Date
    Nov 2006
    Thanked 0 Times in 0 Posts
    I messed around with translate() for a bit but it just doesn't appear to be flexible enough. It could be used to convert it to a single quote I suppose but that isn't really what you asked.

    After that all I can think of is using contains() to figure out if it had a &quot; and if it does do the escaping.

    Sorry, nothing really insightful here.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts