Changeset 2827

Show
Ignore:
Timestamp:
02/28/10 14:41:20
Author:
johnsa
Message:

standardize json widgets to use new json escaping template

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/feeder/webapp/resources/demoskins/MainCampus/default/default/widget-json-cats.xsl

    r2824 r2827  
    5959 
    6060  <xsl:template match="category"> 
    61     <!-- escape keywords --> 
    62     <xsl:variable name="strippedKeyword"> 
    63       <xsl:call-template name="escapeJson"> 
    64         <xsl:with-param name="string" select="value"/> 
    65       </xsl:call-template> 
    66     </xsl:variable> 
    67     <!-- produce the JSON output --> 
    6861            { 
    69                 "value" : "<xsl:value-of select="$strippedKeyword"/>", 
     62                "value" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="value"/></xsl:call-template>", 
    7063                "uid" : "<xsl:value-of select="uid"/>", 
    7164                "creator" : "<xsl:value-of select="creator"/>" 
  • trunk/deployment/feeder/webapp/resources/demoskins/MainCampus/default/default/widget-json-groups.xsl

    r2416 r2827  
    5858 
    5959  <xsl:template match="group"> 
    60     <!-- escape apostrophes from group name --> 
    61     <xsl:variable name="aposStrippedName"> 
    62       <xsl:call-template name="replace"> 
    63         <xsl:with-param name="string" select="name"/> 
    64         <xsl:with-param name="pattern" select='"&apos;"'/> 
    65         <xsl:with-param name="replacement" select='"\&apos;"'/> 
    66       </xsl:call-template> 
    67     </xsl:variable> 
    68     <!-- first, escape apostrophes from group description --> 
    69     <xsl:variable name="aposStrippedDescription"> 
    70       <xsl:call-template name="replace"> 
    71         <xsl:with-param name="string" select="description"/> 
    72         <xsl:with-param name="pattern" select='"&apos;"'/> 
    73         <xsl:with-param name="replacement" select='"\&apos;"'/> 
    74       </xsl:call-template> 
    75     </xsl:variable> 
    76     <!-- second, escape quotes --> 
    77     <xsl:variable name="aposAndQuotesStrippedDescription"> 
    78       <xsl:variable name="quote">&quot;</xsl:variable> 
    79       <xsl:variable name="escQuote"><xsl:text>\</xsl:text>&quot;</xsl:variable>   
    80       <xsl:call-template name="replace"> 
    81         <xsl:with-param name="string" select="$aposStrippedDescription"/> 
    82         <xsl:with-param name="pattern" select="$quote"/> 
    83         <xsl:with-param name="replacement" select="$escQuote"/> 
    84       </xsl:call-template> 
    85     </xsl:variable> 
    86     <!-- third, strip line breaks --> 
    87     <xsl:variable name="strippedDescription" select='translate($aposAndQuotesStrippedDescription,"&#xA;"," ")'/> 
    88     <!-- finally, produce the JSON output --> 
    8960    { 
    9061      "eventOwner" : "<xsl:value-of select="eventOwner"/>", 
    91        "name" : "<xsl:value-of select="$aposStrippedName"/>", 
    92        "description" : "<xsl:value-of select="$strippedDescription"/>", 
     62       "name" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="name"/></xsl:call-template>", 
     63       "description" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="description"/></xsl:call-template>", 
    9364       "memberOf" : [ 
    9465                      { 
     
    10071    
    10172  <xsl:template match="memberof"> 
    102     <!-- escape apostrophes from name --> 
    103     <xsl:variable name="aposStrippedMemberOfName"> 
    104       <xsl:call-template name="replace"> 
    105         <xsl:with-param name="string" select="name"/> 
    106         <xsl:with-param name="pattern" select='"&apos;"'/> 
    107         <xsl:with-param name="replacement" select='"\&apos;"'/> 
    108       </xsl:call-template> 
    109     </xsl:variable> 
    110                          "name" : "<xsl:value-of select="$aposStrippedMemberOfName"/>"<xsl:if test="position() != last()">,</xsl:if> 
     73                         "name" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="name"/></xsl:call-template>"<xsl:if test="position() != last()">,</xsl:if> 
    11174  </xsl:template> 
    11275</xsl:stylesheet>