title: Convert text to XML using XSLT without knowing what the "schema" would be
body: <p>I have a text document that I want to convert to XML using XSLT for easier processing.
  the source file is pretty general, such as this:</p>
  
  <pre><code>[{c=1,d=2},{cc=11,dd=22}]%{f=4,g=5,h={i=6,j=[7,8]}}%
  </code></pre>
  
  <p>I'd like to transform this to an XML file such as this:</p>
  
  <pre><code>&lt;document&gt;
      &lt;header&gt;
          &lt;item&gt;
              &lt;c&gt;1&lt;/c&gt;
              &lt;d&gt;2&lt;/d&gt;
          &lt;/item&gt;
          &lt;item&gt;
              &lt;cc&gt;11&lt;/c&gt;
              &lt;dd&gt;22&lt;/d&gt;
          &lt;/item&gt;
      &lt;/header&gt;
      &lt;content&gt;
          &lt;f&gt;4&lt;/f&gt;
          &lt;g&gt;5&lt;/g&gt;
          &lt;h&gt;
              &lt;i&gt;6&lt;/i&gt;
              &lt;j&gt;
                  &lt;elt&gt;7&lt;/elt&gt;
                  &lt;elt&gt;8&lt;/elt&gt;
              &lt;/j&gt;
          &lt;/h&gt;
      &lt;/content&gt;
  &lt;/document&gt;
  </code></pre>
  
  <p>So in essence, the string before an "=" is the tag name, everything thereafter is the content (with nesting), with the only addition of the document, header, content and elt nodes. The original file will likely contain each value and all "}" on separate lines but that is not guaranteed(I don't know if that matters or not)</p>
  
  <p>I found some answers for similar cases where text is converted to XML, but there the resulting node names and nesting levels are always know beforehand.
  Gut feeling there should be a relatively simple solution to this, but unfortunately I know only that XSLT is powerful and useful, but not who to write it...</p>
  
  <p>Thanks in advance for the help,
  DeColaman</p>