title: XSLT - how to apply a template to every node of the type?
body: <p>I am quite new to xsl and functional programming, so I'll be grateful for help on this one:
  <br><br>
  I have a template that transforms some xml and provides an output. The problem is that there are many elements of type <strong>xs:date</strong>, all in different contexts, that must be localized. I use a concatenation of substrings of these xs:dates to produce a localized date pattern strings.
  <br> <br> 
  As you can guess this causes a lot of copy-paste "<em>substring-this and substring-that</em>". How can I write a template that will automatically transform all the elements of type xs:date to localized strings preserving all the context-aware transformations?
  <br><br>
  My xsl is something like this:</p>
  
  <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;  
      &lt;xsl:output method="html" encoding="utf-8"/&gt;
          &lt;xsl:template match="/"&gt;
          ...
          &lt;input value="{substring(/select/a/date 9,2)}.{substring(/select/a/date, 6,2)}.{substring(/select/a/date 1,4)}"&gt;
          ...
          &lt;!-- assume that following examples are also with substrings --&gt;
          &lt;div&gt;&lt;xsl:value-of select="different-path/to_date"/&gt;&lt;/div&gt;
          ...
          &lt;table&gt;
          &lt;tr&gt;&lt;td&gt;&lt;xsl:value-of select="path/to/another/date"/&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;/table&gt;
          &lt;apply-templates/&gt;
          &lt;/xsl:template&gt;
          &lt;xsl:template match="something else"&gt;
          &lt;!-- more dates here --&gt;
          &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>I hope I managed to make my question clear =)</p>
  
  <p>UPD: Here is an example of xml:</p>
  
  <pre><code>&lt;REQUEST&gt;
      &lt;header&gt;
          &lt;... /&gt;
          &lt;ref&gt;
              &lt;ref_date type="xs:date"&gt;1970-01-01&lt;/ref_date&gt;
          &lt;/ref&gt;
      &lt;/header&gt;
  
      &lt;general&gt;
          &lt;.../&gt;
          &lt;info&gt;
              &lt;.../&gt;
              &lt;date type="xs:date"&gt;1970-01-01&lt;/date&gt;
              &lt;ExpireDate type="xs:date"&gt;1970-01-01&lt;/ExpireDate&gt;
              &lt;RealDate type="xs:date"&gt;1970-01-01&lt;/RealDate&gt;
              &lt;templateDetails&gt;template details&lt;/templateDetails&gt;
              &lt;effectiveDate type="xs:date"&gt;1970-01-01&lt;/effectiveDate&gt;
          &lt;/info&gt;
  
          &lt;party&gt;
              &lt;.../&gt;
                  &lt;date type="xs:date"&gt;1970-01-01&lt;/date&gt;
          &lt;/party&gt;
  
          &lt;!-- many other parts of such kind --&gt;
      &lt;/general&gt;
  
  &lt;/REQUEST&gt;
  </code></pre>
  
  <p>As for the output, there are many different options. The main thing is that these values must be set as a value of different html objects, such as tables, input fields and so on. You can see an example in the xsl listing.</p>
  
  <p>P.S. I'm using xsl 1.0.</p>