Changeset 2825

Show
Ignore:
Timestamp:
02/27/10 18:24:37
Author:
johnsa
Message:

Fixed - 570: list-json.xsl in feeder not ecaping quotes (")
https://www.bedework.org/trac/bedework/ticket/570

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • releases/bedework-3.6/deployment/feeder/webapp/resources/demoskins/MainCampus/default/default/list-json.xsl

    r2587 r2825  
    4646    <xsl:choose> 
    4747      <xsl:when test="/bedework/appvar/key = 'objName'"> 
    48         var <xsl:value-of select="/bedework/appvar[key='objName']/value"/> = {'bwEventList': { 
     48        var <xsl:value-of select="/bedework/appvar[key='objName']/value"/> = {"bwEventList": { 
    4949      </xsl:when> 
    5050      <xsl:otherwise> 
    51         {'bwEventList': { 
     51        {"bwEventList": { 
    5252      </xsl:otherwise> 
    5353    </xsl:choose> 
    54         'events': [ 
     54        "events": [ 
    5555           <xsl:apply-templates select="/bedework/events" /> 
    5656        ] 
  • releases/bedework-3.6/deployment/feeder/webapp/resources/demoskins/MainCampus/default/default/widget-json-cats.xsl

    r2525 r2825  
    5959 
    6060  <xsl:template match="category"> 
    61     <!-- first, escape apostrophes --> 
    62     <xsl:variable name="aposStrippedKeyword"> 
    63       <xsl:call-template name="replace"> 
     61    <!-- escape keywords --> 
     62    <xsl:variable name="strippedKeyword"> 
     63      <xsl:call-template name="escapeJson"> 
    6464        <xsl:with-param name="string" select="value"/> 
    65         <xsl:with-param name="pattern" select='"&apos;"'/> 
    66         <xsl:with-param name="replacement" select='"\&apos;"'/> 
    6765      </xsl:call-template> 
    6866    </xsl:variable> 
    69     <!-- second, strip line breaks --> 
    70     <xsl:variable name="strippedKeyword" select='translate($aposStrippedKeyword,"&#xA;"," ")'/> 
    71     <!-- finally, produce the JSON output --> 
     67    <!-- produce the JSON output --> 
    7268            { 
    7369                "value" : "<xsl:value-of select="$strippedKeyword"/>", 
  • releases/bedework-3.6/deployment/feeder/webapp/resources/demoskins/MainCampus/default/default/xsl/jsonEvent.xsl

    r2639 r2825  
    22<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    33  <xsl:template match="event"> 
    4     <!-- first, escape apostrophes --> 
    5     <xsl:variable name="aposStrippedSummary"> 
    6       <xsl:call-template name="replace"> 
    7         <xsl:with-param name="string" select="summary"/> 
    8         <xsl:with-param name="pattern" select='"&apos;"'/> 
    9         <xsl:with-param name="replacement" select='"\&apos;"'/> 
    10       </xsl:call-template> 
    11     </xsl:variable> 
    12     <xsl:variable name="aposStrippedDescription"> 
    13       <xsl:call-template name="replace"> 
    14         <xsl:with-param name="string" select="description"/> 
    15         <xsl:with-param name="pattern" select='"&apos;"'/> 
    16         <xsl:with-param name="replacement" select='"\&apos;"'/> 
    17       </xsl:call-template> 
    18     </xsl:variable> 
    19     <xsl:variable name="aposStrippedLocAddress"> 
    20       <xsl:call-template name="replace"> 
    21         <xsl:with-param name="string" select="location/address"/> 
    22         <xsl:with-param name="pattern" select='"&apos;"'/> 
    23         <xsl:with-param name="replacement" select='"\&apos;"'/> 
    24       </xsl:call-template> 
    25     </xsl:variable> 
    26     <xsl:variable name="aposStrippedContactName"> 
    27       <xsl:call-template name="replace"> 
    28         <xsl:with-param name="string" select="contact/name"/> 
    29         <xsl:with-param name="pattern" select='"&apos;"'/> 
    30         <xsl:with-param name="replacement" select='"\&apos;"'/> 
    31       </xsl:call-template> 
    32     </xsl:variable> 
    33     <!-- second, strip line breaks --> 
    34     <xsl:variable name="strippedSummary" select='translate($aposStrippedSummary,"&#xA;"," ")'/> 
    35     <xsl:variable name="strippedDescription" select='translate($aposStrippedDescription,"&#xA;"," ")'/> 
    36     <xsl:variable name="strippedLocAddress" select='translate($aposStrippedLocAddress,"&#xA;"," ")'/> 
    37     <!-- finally, produce the JSON output --> 
    38                   { 
    39                     "summary" : "<xsl:value-of select="$strippedSummary"/>", 
    40                     "subscriptionId" : "<xsl:value-of select="subscription/id"/>", 
    41                     "calPath" : "<xsl:value-of select="calendar/encodedPath"/>", 
    42                     "guid" : "<xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template>", 
    43                     "recurrenceId" : "<xsl:value-of select="recurrenceId"/>", 
    44                     "link" : "<xsl:value-of select='link'/>", 
    45                     "eventlink" : "<xsl:value-of select="$urlPrefix"/><xsl:value-of select="$eventView"/>&amp;calPath=<xsl:value-of select="calendar/encodedPath"/>&amp;guid=<xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template>&amp;recurrenceId=<xsl:value-of select="recurrenceId"/>", 
    46                     "status" : "<xsl:value-of select='status'/>", 
    47                     "start" : { 
    48                       "allday" : "<xsl:value-of select='start/allday'/>", 
    49                       "shortdate" : "<xsl:value-of select='start/shortdate'/>", 
    50                       "longdate" : "<xsl:value-of select='start/longdate'/>", 
    51                       "dayname" : "<xsl:value-of select='start/dayname'/>", 
    52                       "time" : "<xsl:value-of select='start/time'/>", 
    53                       "utcdate" : "<xsl:value-of select='start/utcdate'/>", 
    54                       "datetime" : "<xsl:value-of select='start/unformatted'/>", 
    55                       "timezone" : "<xsl:value-of select='start/timezone/id'/>" 
    56                     }, 
    57                     "end" : { 
    58                       "allday" : "<xsl:value-of select='end/allday'/>", 
    59                       "shortdate" : "<xsl:value-of select='end/shortdate'/>", 
    60                       "longdate" : "<xsl:value-of select='end/longdate'/>", 
    61                       "dayname" : "<xsl:value-of select='end/dayname'/>", 
    62                       "time" : "<xsl:value-of select='end/time'/>", 
    63                       "utcdate" : "<xsl:value-of select='end/utcdate'/>", 
    64                       "datetime" : "<xsl:value-of select='end/unformatted'/>", 
    65                       "timezone" : "<xsl:value-of select='end/timezone/id'/>" 
    66                     }, 
    67                     "location" : { 
    68                       "address" : "<xsl:value-of select="$strippedLocAddress"/>", 
    69                       "link" : "<xsl:value-of select='location/link'/>" 
    70                     }, 
    71                     "contact" : { 
    72                       "name" : "<xsl:value-of select="$aposStrippedContactName"/>", 
    73                       "phone" : "<xsl:value-of select="contact/phone"/>",<!-- 
    74                       "email" : "<xsl:value-of select="contact/email"/>", --> 
    75                       "link" : "<xsl:value-of select='contact/link'/>" 
    76                     }, 
    77                     "calendar" : { 
    78                       "name" : "<xsl:value-of select='calendar/name'/>", 
    79                       "path" : "<xsl:value-of select='calendar/path'/>", 
    80                       "encodedPath" : "<xsl:value-of select='calendar/encodedPath'/>" 
    81                     }, 
    82                     "categories" : [ 
    83                       <xsl:for-each select='categories/category'>"<xsl:value-of select='value'/>"<xsl:if test='position() != last()'>,</xsl:if></xsl:for-each> 
    84                     ], 
    85                     "description" : "<xsl:value-of select='$strippedDescription'/>", 
    86                     "cost" : "<xsl:value-of select='cost'/>", 
    87                     "xproperties" : [ 
    88                       <xsl:for-each select="xproperties/node()[name() != '']"> 
    89                       { 
    90                         "<xsl:value-of select='name()'/>" : { 
    91                           "values" : { 
    92                              <xsl:for-each select="values/node()[name() != '']"> 
    93                                "<xsl:value-of select='name()'/>" : "<xsl:call-template name="replace"><xsl:with-param name="string" select="."/><xsl:with-param name="pattern" select='"&apos;"'/><xsl:with-param name="replacement" select='"\&apos;"'/></xsl:call-template>"<xsl:if test='position() != last()'>,</xsl:if> 
    94                              </xsl:for-each> 
    95                           } 
    96                         } 
    97                       }<xsl:if test='position() != last()'>,</xsl:if></xsl:for-each> 
     4          { 
     5            "summary" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="summary"/></xsl:call-template>", 
     6            "subscriptionId" : "<xsl:value-of select="subscription/id"/>", 
     7            "calPath" : "<xsl:value-of select="calendar/encodedPath"/>", 
     8            "guid" : "<xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template>", 
     9            "recurrenceId" : "<xsl:value-of select="recurrenceId"/>", 
     10            "link" : "<xsl:value-of select='link'/>", 
     11            "eventlink" : "<xsl:value-of select="$urlPrefix"/><xsl:value-of select="$eventView"/>&amp;calPath=<xsl:value-of select="calendar/encodedPath"/>&amp;guid=<xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template>&amp;recurrenceId=<xsl:value-of select="recurrenceId"/>", 
     12            "status" : "<xsl:value-of select='status'/>", 
     13            "start" : { 
     14              "allday" : "<xsl:value-of select='start/allday'/>", 
     15              "shortdate" : "<xsl:value-of select='start/shortdate'/>", 
     16              "longdate" : "<xsl:value-of select='start/longdate'/>", 
     17              "dayname" : "<xsl:value-of select='start/dayname'/>", 
     18              "time" : "<xsl:value-of select='start/time'/>", 
     19              "utcdate" : "<xsl:value-of select='start/utcdate'/>", 
     20              "datetime" : "<xsl:value-of select='start/unformatted'/>", 
     21              "timezone" : "<xsl:value-of select='start/timezone/id'/>" 
     22            }, 
     23            "end" : { 
     24              "allday" : "<xsl:value-of select='end/allday'/>", 
     25              "shortdate" : "<xsl:value-of select='end/shortdate'/>", 
     26              "longdate" : "<xsl:value-of select='end/longdate'/>", 
     27              "dayname" : "<xsl:value-of select='end/dayname'/>", 
     28              "time" : "<xsl:value-of select='end/time'/>", 
     29              "utcdate" : "<xsl:value-of select='end/utcdate'/>", 
     30              "datetime" : "<xsl:value-of select='end/unformatted'/>", 
     31              "timezone" : "<xsl:value-of select='end/timezone/id'/>" 
     32            }, 
     33            "location" : { 
     34              "address" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="location/address"/></xsl:call-template>", 
     35              "link" : "<xsl:value-of select='location/link'/>" 
     36            }, 
     37            "contact" : { 
     38              "name" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="contact/name"/></xsl:call-template>", 
     39              "phone" : "<xsl:value-of select="contact/phone"/>",<!-- 
     40              "email" : "<xsl:value-of select="contact/email"/>", --> 
     41              "link" : "<xsl:value-of select='contact/link'/>" 
     42            }, 
     43            "calendar" : { 
     44              "name" : "<xsl:value-of select='calendar/name'/>", 
     45              "path" : "<xsl:value-of select='calendar/path'/>", 
     46              "encodedPath" : "<xsl:value-of select='calendar/encodedPath'/>" 
     47            }, 
     48            "categories" : [ 
     49              <xsl:for-each select='categories/category'>"<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="value"/></xsl:call-template>"<xsl:if test='position() != last()'>,</xsl:if></xsl:for-each> 
     50            ], 
     51            "description" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="description"/></xsl:call-template>", 
     52            "cost" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="cost"/></xsl:call-template>", 
     53            "xproperties" : [ 
     54              <xsl:for-each select="xproperties/node()[name() != '']"> 
     55              { 
     56                "<xsl:value-of select='name()'/>" : { 
     57                  "values" : { 
     58                     <xsl:for-each select="values/node()[name() != '']"> 
     59                       "<xsl:value-of select='name()'/>" : "<xsl:call-template name="escapeJson"><xsl:with-param name="string" select="."/></xsl:call-template>"<xsl:if test='position() != last()'>,</xsl:if> 
     60                     </xsl:for-each> 
     61                  } 
     62                } 
     63              }<xsl:if test='position() != last()'>,</xsl:if></xsl:for-each> 
    9864 
    99                    
    100                  }<xsl:if test="position() != last()">,</xsl:if> 
     65           
     66         }<xsl:if test="position() != last()">,</xsl:if> 
    10167  </xsl:template> 
    10268</xsl:stylesheet> 
  • releases/bedework-3.6/deployment/resources/xsl/default/default/util.xsl

    r2427 r2825  
    1919      </xsl:otherwise> 
    2020    </xsl:choose> 
     21  </xsl:template> 
     22   
     23  <!-- escape line breaks and double quotes  --> 
     24  <xsl:template name="escapeJson"> 
     25    <xsl:param name="string"/> 
     26    <xsl:call-template name="replace"> 
     27      <xsl:with-param name="string"> 
     28        <xsl:call-template name="replace"> 
     29          <xsl:with-param name="string" select="$string"/> 
     30          <xsl:with-param name="pattern" select="'&#xA;'"/> 
     31          <xsl:with-param name="replacement" select="'\n'"/> 
     32        </xsl:call-template> 
     33      </xsl:with-param> 
     34      <xsl:with-param name="pattern" select="'&quot;'"/> 
     35      <xsl:with-param name="replacement" select="'\&quot;'"/> 
     36    </xsl:call-template> 
    2137  </xsl:template> 
    2238