Advertisement
Guest User

part of APA xml

a guest
Dec 5th, 2014
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.11 KB | None | 0 0
  1. <xsl:template name="StringFormatDate">
  2.         <xsl:param name="format" />
  3.        
  4.         <xsl:param name="day"/>
  5.         <xsl:param name="month"/>
  6.         <xsl:param name="year"/>       
  7.        
  8.         <xsl:param name="withDot" />
  9.  
  10.     <xsl:variable name="prop_EndChars">
  11.       <xsl:call-template name="templ_prop_EndChars"/>
  12.     </xsl:variable>
  13.  
  14.     <xsl:choose>
  15.             <xsl:when test="$format = ''"></xsl:when>
  16.             <xsl:when test="substring($format, 1, 2) = '%%'">
  17.                 <xsl:text>%</xsl:text>
  18.                 <xsl:call-template name="StringFormatDate">
  19.                     <xsl:with-param name="format" select="substring($format, 3)" />
  20.                     <xsl:with-param name="day" select="$day"/>
  21.                     <xsl:with-param name="month" select="$month"/>
  22.                     <xsl:with-param name="year" select="$year"/>
  23.                     <xsl:with-param name="withDot" select="$withDot" />
  24.                 </xsl:call-template>
  25.                 <xsl:if test="string-length($format)=2 and withDot = 'yes' and not(contains($prop_EndChars, '%'))">
  26.                     <xsl:call-template name="templ_prop_Dot"/>
  27.                 </xsl:if>
  28.             </xsl:when>
  29.             <xsl:when test="substring($format, 1, 1) = '%'">
  30.                 <xsl:variable name="what" select="substring($format, 2, 1)" />
  31.                 <xsl:choose>
  32.                     <xsl:when test="$what = 'D'">
  33.                         <xsl:value-of select="$day"/>
  34.                     </xsl:when>
  35.                     <xsl:when test="$what = 'M'">
  36.                         <xsl:value-of select="$month"/>
  37.                     </xsl:when>
  38.                     <xsl:when test="$what = 'Y'">
  39.                         <xsl:value-of select="$year"/>
  40.                     </xsl:when>
  41.                 </xsl:choose>
  42.                 <xsl:call-template name="StringFormatDate">
  43.                     <xsl:with-param name="format" select="substring($format, 3)" />
  44.                     <xsl:with-param name="day" select="$day"/>
  45.                     <xsl:with-param name="month" select="$month"/>
  46.                     <xsl:with-param name="year" select="$year"/>
  47.                     <xsl:with-param name="withDot" select="$withDot" />
  48.                 </xsl:call-template>
  49.                 <xsl:if test="string-length($format)=2 and withDot='yes'">
  50.                     <xsl:variable name="temp2">
  51.                         <xsl:call-template name="handleSpaces">
  52.                             <xsl:with-param name="field">
  53.                                 <xsl:call-template name="formatNameOneItem">
  54.                                     <xsl:with-param name="format" select="$what"/>
  55.                                 </xsl:call-template>
  56.                             </xsl:with-param>
  57.                         </xsl:call-template>
  58.                     </xsl:variable>            
  59.                     <xsl:variable name="lastChar">
  60.                         <xsl:value-of select="substring($temp2, string-length($temp2))"/>
  61.                     </xsl:variable>
  62.                     <xsl:if test="not(contains($prop_EndChars, $lastChar))">
  63.                         <xsl:call-template name="templ_prop_Dot"/>
  64.                     </xsl:if>
  65.                 </xsl:if>
  66.             </xsl:when>
  67.             <xsl:otherwise>
  68.                 <xsl:value-of select="substring($format, 1, 1)" />
  69.                 <xsl:call-template name="StringFormatDate">
  70.                     <xsl:with-param name="format" select="substring($format, 2)" />
  71.                     <xsl:with-param name="day" select="$day"/>
  72.                     <xsl:with-param name="month" select="$month"/>
  73.                     <xsl:with-param name="year" select="$year"/>
  74.                     <xsl:with-param name="withDot" select="$withDot" />
  75.                 </xsl:call-template>
  76.                 <xsl:if test="string-length($format)=1">
  77.                     <xsl:if test="withDot = 'yes' and not(contains($prop_EndChars, $format))">
  78.                         <xsl:call-template name="templ_prop_Dot"/>
  79.                     </xsl:if>
  80.                 </xsl:if>
  81.             </xsl:otherwise>
  82.         </xsl:choose>
  83.     </xsl:template>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement