title: Replace comma with a dot in in XSL
body: <p>I have an XSLT which is used to transform a CSV into a XML.
  The second column of the csv contains numbers such as, i.e. 5,0000 </p>
  
  <p>What I need is to transform this number into 5.0000 or even better, just 5. Means: Replace the , by a . would be one possibility or cut away the decimal symbol and whatever follows it.</p>
  
  <p>I've been trying with translate(), format-number(), number() for hours, considering everything I found with googeling and searching in forums. Unfortunately I didn't manage to make it work so far. The only error message I keep on getting, no matter what I try, is that the Stylesheet couldn't been compiled, due to an error. Debugging isn't possible either as far as I know, as the input file is a CSV and not an XML
  Could somebody please help me out?</p>
  
  <p>See Input example (CSV) and XSL below (the variable to change is called testAmount):</p>
  
  <pre><code>9612045901;5,000;Stk.;SomeText 1;M;72,04
  5-10495;1,000;Stk.;SomeText 2;M;5,93
  9612045901;5,000;Stk.;SomeText 3;72,04
  5-10495;1,000;Stk.;SomeText 4;M;5,93
  
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="fn" exclude-result-prefixes="xs fn"&gt;
  &lt;xsl:output indent="yes" encoding="UTF-8" /&gt;
  &lt;xsl:param name="csvFile"/&gt;
  
  &lt;!-- 
  Constants
  --&gt;
  &lt;xsl:variable name="V_ITEM_POS" select="number(1)" /&gt;
  &lt;xsl:variable name="V_ITEM_DESC_POS" select="number(4)" /&gt;
  &lt;xsl:variable name="V_AMOUNT_POS" select="number(2)" /&gt;
  &lt;xsl:variable name="V_ZONE"&gt;ZONE1&lt;/xsl:variable&gt;
  &lt;xsl:variable name="V_PRIORITY"&gt;9&lt;/xsl:variable&gt;
  &lt;!--  
    EVENTUELL SHPG &amp; RECV für IBD &amp; OBD UNTERSCHEIDEN !!! 
  --&gt;
  &lt;xsl:variable name="V_IBD_TYPE_ID"&gt;SHPG&lt;/xsl:variable&gt;
  
  
   &lt;!--
  MAIN
  --&gt;
  &lt;xsl:template match="/" name="main"&gt;
    &lt;xsl:variable name="csv" select="unparsed-text($csvFile)" /&gt;
    &lt;xsl:variable name="lines" select="tokenize($csv, '&amp;#xA;')" as="xs:string+" /&gt;
    &lt;xsl:variable name="orderNumber" select="format-dateTime(current-dateTime(), '[Y0001][M01][D01][H01][m01][s01][f0001]')" /&gt;
    &lt;!--
  
    Determine inbound or outbound order 
  
    positiv amound will create an inbound order
    negative amound will create an outbound order
  
    Test at first value line
    --&gt;
    &lt;xsl:for-each select="$lines"&gt;
       &lt;xsl:variable name="rowPos" select="position()" /&gt;
       &lt;xsl:if test="$rowPos = 1"&gt;
          &lt;xsl:variable name="testLineItems" select="tokenize(., ';')" /&gt;
          &lt;xsl:variable name="testAmount" select="number($testLineItems[$V_AMOUNT_POS])" /&gt;
          &lt;!--
              INBOUND DELIVERY
          --&gt;
          &lt;xsl:if test="$testAmount &amp;lt; 0"&gt;
             &lt;xsl:call-template name="TMPL_INBOUND_DELIVERY"&gt;
                &lt;xsl:with-param name="in_lines" select="$lines" /&gt;
                &lt;xsl:with-param name="in_orderNumber" select="$orderNumber" /&gt;
             &lt;/xsl:call-template&gt;
          &lt;/xsl:if&gt;
          &lt;!--
              OUTBOUND DELIVERY
          --&gt;
          &lt;xsl:if test="$testAmount &amp;gt; 0"&gt;
             &lt;xsl:call-template name="TMPL_OUTBOUND_DELIVERY"&gt;
                &lt;xsl:with-param name="in_lines" select="$lines" /&gt;
                &lt;xsl:with-param name="in_orderNumber" select="$orderNumber" /&gt;
             &lt;/xsl:call-template&gt;
          &lt;/xsl:if&gt;
  
       &lt;/xsl:if&gt;
    &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
  &lt;!--
  
   INBOUND DELIVERY TEMPLATE
  --&gt;
  &lt;xsl:template name="TMPL_INBOUND_DELIVERY"&gt;
    &lt;xsl:param name="in_lines" /&gt;
    &lt;xsl:param name="in_orderNumber" /&gt;
    &lt;DI_TELEGRAM&gt;
       &lt;HEADER&gt;
          &lt;FULL&gt;
             &lt;HEADER_SOURCE&gt;HOST&lt;/HEADER_SOURCE&gt;
             &lt;HEADER_DESTINATION&gt;WAMAS&lt;/HEADER_DESTINATION&gt;
             &lt;HEADER_SEQUENCE&gt;1&lt;/HEADER_SEQUENCE&gt;
             &lt;HEADER_RECORDTYPENAME&gt;LOGIMATIBD00001&lt;/HEADER_RECORDTYPENAME&gt;
          &lt;/FULL&gt;
       &lt;/HEADER&gt;
       &lt;BODY&gt;
          &lt;LogimatIbdGroup&gt;
             &lt;LOGIMATIBD00001&gt;
                &lt;InboundDelivery_ibdNo&gt;
                   &lt;xsl:value-of select="$in_orderNumber" /&gt;
                &lt;/InboundDelivery_ibdNo&gt;
                &lt;InboundDelivery_priority&gt;
                   &lt;xsl:value-of select="$V_PRIORITY" /&gt;
                &lt;/InboundDelivery_priority&gt;
                &lt;InboundDelivery_deliveryNoteNo&gt;&lt;/InboundDelivery_deliveryNoteNo&gt;
                &lt;InboundDelivery_type_ibdTypeId&gt;
                   &lt;xsl:value-of select="$V_IBD_TYPE_ID" /&gt;
                &lt;/InboundDelivery_type_ibdTypeId&gt;
                &lt;InboundDelivery_externalRef&gt;&lt;/InboundDelivery_externalRef&gt;
                &lt;InboundDelivery_unloadingPoint_area_areaId&gt;
                   &lt;xsl:value-of select="$V_ZONE" /&gt;
                &lt;/InboundDelivery_unloadingPoint_area_areaId&gt;
                &lt;LOGIMATIBD00001_subList&gt;
                   &lt;xsl:for-each select="$in_lines"&gt;
                      &lt;xsl:variable name="lineItems" select="tokenize(., ';')" /&gt;
                         &lt;!-- remove empty lines --&gt;
                         &lt;xsl:if test="number($lineItems[$V_AMOUNT_POS])!= number(0)"&gt;
                            &lt;xsl:call-template name="TMPL_INBOUND_DELIVERY_LINE"&gt;
                               &lt;xsl:with-param name="in_orderNumber" select="$in_orderNumber" /&gt;
                               &lt;xsl:with-param name="in_sysPartnerLine" select="position() -1" /&gt;
                               &lt;xsl:with-param name="in_itemNumber" select="$lineItems[$V_ITEM_POS]" /&gt;
                               &lt;xsl:with-param name="in_amount" select="$lineItems[$V_AMOUNT_POS]" /&gt;
                            &lt;/xsl:call-template&gt;
                         &lt;/xsl:if&gt;
                   &lt;/xsl:for-each&gt;
                &lt;/LOGIMATIBD00001_subList&gt;
             &lt;/LOGIMATIBD00001&gt;
          &lt;/LogimatIbdGroup&gt;
       &lt;/BODY&gt;
    &lt;/DI_TELEGRAM&gt;
  &lt;/xsl:template&gt;
  &lt;!--
  
   INBOUND DELIVERY LINE TEMPLATE
  --&gt;
  &lt;xsl:template name="TMPL_INBOUND_DELIVERY_LINE"&gt;
    &lt;xsl:param name="in_orderNumber" /&gt;
    &lt;xsl:param name="in_sysPartnerLine" /&gt;
    &lt;xsl:param name="in_itemNumber" /&gt;
    &lt;xsl:param name="in_amount" /&gt;
    &lt;LOGIMATIBDL00001&gt;
       &lt;InboundDeliveryLine_InboundDelivery_ibdNo&gt;
          &lt;xsl:value-of select="$in_orderNumber" /&gt;
       &lt;/InboundDeliveryLine_InboundDelivery_ibdNo&gt;
       &lt;InboundDeliveryLine_sysPartnerLine&gt;
          &lt;xsl:value-of select="$in_sysPartnerLine" /&gt;
       &lt;/InboundDeliveryLine_sysPartnerLine&gt;
       &lt;InboundDeliveryLine_iga_pkv_Item_itemNo&gt;
          &lt;xsl:value-of select="$in_itemNumber" /&gt;
       &lt;/InboundDeliveryLine_iga_pkv_Item_itemNo&gt;
       &lt;InboundDeliveryLine_iga_batch&gt;&lt;/InboundDeliveryLine_iga_batch&gt;
       &lt;InboundDeliveryLine_iga_bbDate&gt;&lt;/InboundDeliveryLine_iga_bbDate&gt;
       &lt;InboundDeliveryLine_orderAmount_baseQty&gt;
          &lt;xsl:value-of select="$in_amount" /&gt;
       &lt;/InboundDeliveryLine_orderAmount_baseQty&gt;
    &lt;/LOGIMATIBDL00001&gt;
  &lt;/xsl:template&gt;
  &lt;!--
  
   OUTBOUND DELIVERY TEMPLATE
  --&gt;
  &lt;xsl:template name="TMPL_OUTBOUND_DELIVERY"&gt;
    &lt;xsl:param name="in_lines" /&gt;
    &lt;xsl:param name="in_orderNumber" /&gt;
    &lt;DI_TELEGRAM&gt;
       &lt;!-- The document root --&gt;
       &lt;HEADER&gt;
          &lt;FULL&gt;
             &lt;HEADER_SOURCE&gt;HOST&lt;/HEADER_SOURCE&gt;
             &lt;HEADER_DESTINATION&gt;WAMAS&lt;/HEADER_DESTINATION&gt;
             &lt;HEADER_SEQUENCE&gt;1&lt;/HEADER_SEQUENCE&gt;
             &lt;HEADER_RECORDTYPENAME&gt;LOGIMATOBD00001&lt;/HEADER_RECORDTYPENAME&gt;
          &lt;/FULL&gt;
       &lt;/HEADER&gt;
       &lt;BODY&gt;
          &lt;!-- The content data --&gt;
          &lt;LogimatObdGroup&gt;
             &lt;LOGIMATOBD00001&gt;
                &lt;OutboundDelivery_obdNo&gt;
                   &lt;xsl:value-of select="$in_orderNumber" /&gt;
                &lt;/OutboundDelivery_obdNo&gt;
                &lt;OutboundDelivery_priority&gt;
                   &lt;xsl:value-of select="$V_PRIORITY" /&gt;
                &lt;/OutboundDelivery_priority&gt;
                &lt;OutboundDelivery_deliveryTime&gt;&lt;/OutboundDelivery_deliveryTime&gt;
                &lt;OutboundDelivery_deliveryNoteNo&gt;&lt;/OutboundDelivery_deliveryNoteNo&gt;
                &lt;OutboundDelivery_type_obdTypeId&gt;
                   &lt;xsl:value-of select="$V_IBD_TYPE_ID" /&gt;
                &lt;/OutboundDelivery_type_obdTypeId&gt;
                &lt;OutboundDelivery_externalRef&gt;&lt;/OutboundDelivery_externalRef&gt;
                &lt;Zone&gt;
                   &lt;xsl:value-of select="$V_ZONE" /&gt;
                &lt;/Zone&gt;
                &lt;LOGIMATOBD00001_subList&gt;
                   &lt;xsl:for-each select="$in_lines"&gt;
                      &lt;xsl:variable name="lineItems" select="tokenize(., ';')" /&gt;
                         &lt;!-- remove empty lines --&gt;
                         &lt;xsl:if test="number($lineItems[$V_AMOUNT_POS])"&gt;
                            &lt;xsl:call-template name="TMPL_OUTBOUND_DELIVERY_LINE"&gt;
                               &lt;xsl:with-param name="in_orderNumber" select="$in_orderNumber" /&gt;
                               &lt;xsl:with-param name="in_sysPartnerLine" select="position() -1" /&gt;
                               &lt;xsl:with-param name="in_itemNumber" select="$lineItems[$V_ITEM_POS]" /&gt;
                               &lt;xsl:with-param name="in_amount" select="number($lineItems[$V_AMOUNT_POS]) * -1" /&gt;
                            &lt;/xsl:call-template&gt;
                         &lt;/xsl:if&gt;
                   &lt;/xsl:for-each&gt;
                &lt;/LOGIMATOBD00001_subList&gt;
             &lt;/LOGIMATOBD00001&gt;
          &lt;/LogimatObdGroup&gt;
       &lt;/BODY&gt;
    &lt;/DI_TELEGRAM&gt;
  &lt;/xsl:template&gt;
  &lt;!--
  
   OUTBOUND DELIVERY LINE TEMPLATE
  --&gt;
  &lt;xsl:template name="TMPL_OUTBOUND_DELIVERY_LINE"&gt;
    &lt;xsl:param name="in_orderNumber" /&gt;
    &lt;xsl:param name="in_sysPartnerLine" /&gt;
    &lt;xsl:param name="in_itemNumber" /&gt;
    &lt;xsl:param name="in_amount" /&gt;
    &lt;LOGIMATOBDL00001&gt;
       &lt;OutboundDeliveryLine_OutboundDelivery_obdNo&gt;
          &lt;xsl:value-of select="$in_orderNumber" /&gt;
       &lt;/OutboundDeliveryLine_OutboundDelivery_obdNo&gt;
       &lt;OutboundDeliveryLine_sysPartnerLine&gt;
          &lt;xsl:value-of select="$in_sysPartnerLine" /&gt;
       &lt;/OutboundDeliveryLine_sysPartnerLine&gt;
       &lt;OutboundDeliveryLine_oga_pkv_Item_itemNo&gt;
          &lt;xsl:value-of select="$in_itemNumber" /&gt;
       &lt;/OutboundDeliveryLine_oga_pkv_Item_itemNo&gt;
       &lt;OutboundDeliveryLine_oga_batch&gt;&lt;/OutboundDeliveryLine_oga_batch&gt;
       &lt;OutboundDeliveryLine_oga_bbDate&gt;&lt;/OutboundDeliveryLine_oga_bbDate&gt;
       &lt;OutboundDeliveryLine_orderAmount_baseQty&gt;
          &lt;xsl:value-of select="$in_amount" /&gt;
       &lt;/OutboundDeliveryLine_orderAmount_baseQty&gt;
    &lt;/LOGIMATOBDL00001&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>