title: Need to add comma to a variable for an XSL Template
body: <p>I'm trying to add a comma to the bill that is printed from our customer information system. From what I understand the application pulls a customer's data from sql server and creates an xml file.  Then that xml file is compared against an xsl file for formatting and a new xml file and pdf are created. </p>
  
  <p>I don't know much about xml but from what I can tell the @previousread, @current, and @usage are variables that are interpreted from an xml stream from our application.  These three variables represent the previous meter read, current meter read, and consumption (usage).  </p>
  
  <p>My organization wants me to add commas for thousands.  As of this post our bill just posts a bunch of number together.  I don't see a problem with the way the numbers look and don't see why we need commas, but I'm expected to make it have commas.  </p>
  
  <p>I'm not a web developer but I do have a little experience with sql server.  I've spent about 8 hours working on this and thought I had it figured out only to see the pdf doesn't have commas.</p>
  
  <p>I've seen examples online for how to format a number when its a constant value but the value for each meter read is different and I don't know how to compensate for that.  </p>
  
  <p>I've posted the code as it was originally and as I've edited it.  </p>
  
  <p>This is the original code.</p>
  
  <pre><code>&lt;fo:table-cell text-align="left" padding-left="10pt"&gt;
  &lt;fo:block border-right-style="solid" border-color="black" border-width="0.2pt"&gt;
  &lt;xsl:value-of select="@utility"/&gt;
  &lt;/fo:block&gt;
  &lt;/fo:table-cell&gt;
  &lt;xsl:if test="count(meter/meterread) &amp;gt; 0"&gt;
  &lt;fo:table-cell text-align="center" border-right-style="solid" border-color="black" border-width="0.2pt"&gt;
  &lt;fo:block&gt;
  &lt;xsl:value-of select="descendant::meter/meterread[1]/@previousread"/&gt;
  &lt;/fo:block&gt;
  &lt;/fo:table-cell&gt;
  &lt;fo:table-cell text-align="center" border-right-style="solid" border-   color="black" border-width="0.2pt"&gt;
  &lt;fo:block&gt;
  &lt;xsl:value-of select="descendant::meter/meterread[last()]/@current"/&gt;
  &lt;/fo:block&gt;
  &lt;/fo:table-cell&gt;   
  &lt;fo:table-cell text-align="center" border-right-style="solid" border-  color="black" border-width="0.2pt"&gt;
  &lt;fo:block&gt;
  &lt;xsl:choose&gt;
  &lt;xsl:when test="string-length(meter/meterread/@billingusage) &amp;gt; 0"&gt;
  &lt;xsl:value-of select="sum(meter/meterread/@billingusage)"/&gt;
  &lt;/xsl:when&gt;
  &lt;xsl:otherwise&gt;
  &lt;xsl:value-of select="sum(meter/meterread/@usage)"/&gt;
  &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  &lt;/fo:block&gt;
  &lt;/fo:table-cell&gt; 
  </code></pre>
  
  <p>Here is the code as I've edited it. </p>
  
  <pre><code>&lt;fo:table-cell text-align="left" padding-left="10pt"&gt;
  &lt;fo:block border-right-style="solid" border-color="black" border-width="0.2pt"&gt;
  &lt;xsl:value-of select="@utility"/&gt;
  &lt;/fo:block&gt;
  &lt;/fo:table-cell&gt;
  &lt;xsl:if test="count(meter/meterread) &amp;gt; 0"&gt;
  &lt;fo:table-cell text-align="center" border-right-style="solid" border-color="black" border-width="0.2pt"&gt;
  &lt;fo:block&gt;
  &lt;xsl:value-of select="descendant::meter/meterread[1]/@previousread"/&gt;
  &lt;/fo:block&gt;
  &lt;/fo:table-cell&gt;
  &lt;fo:table-cell text-align="center" border-right-style="solid" border-color="black" border-width="0.2pt"&gt;
  &lt;fo:block&gt;
  &lt;xsl:value-of select="descendant::meter/meterread[last()]/@current"/&gt;
  &lt;/fo:block&gt;
  &lt;/fo:table-cell&gt;   
  &lt;fo:table-cell text-align="center" border-right-style="solid" border-color="black" border-width="0.2pt"&gt;
  &lt;fo:block&gt;
  &lt;xsl:choose&gt;
  &lt;xsl:when test="string-length(meter/meterread/@billingusage) &amp;gt; 0"&gt;
  &lt;xsl:value-of select="sum(meter/meterread/@billingusage)"/&gt;
  &lt;/xsl:when&gt;
  &lt;xsl:otherwise&gt;
  &lt;xsl:value-of select="sum(meter/meterread/@usage)"/&gt;
  &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  &lt;/fo:block&gt;
  &lt;/fo:table-cell&gt; 
  </code></pre>