Note that there are some explanatory texts on larger screens.

plurals
  1. POXML to XML transformation via XSL/XSLT?
    primarykey
    data
    text
    <p>I am trying very hard with no luck to take an XML document which is spit out by a proprietary database and transform it into a well-formed XML document which will eventually be indexed by Apache Solr.</p> <p>I would like to take this XML file and transform it into a Apache Solr format like that below it.</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;ecatalogue&gt; &lt;tuple&gt; &lt;table name="CatObjectName_tab"&gt; &lt;tuple&gt; &lt;atom name="CatObjectName"&gt;Clog&lt;/atom&gt; &lt;/tuple&gt; &lt;/table&gt; &lt;atom name="CatObjectNumber"&gt;2003-39-27A&lt;/atom&gt; &lt;atom name="CatObjectTitle"&gt;&lt;/atom&gt; &lt;table name="CatOtherNumbers_tab"&gt; &lt;tuple&gt; &lt;atom name="CatOtherNumbers"&gt;1895.1.117a&lt;/atom&gt; &lt;/tuple&gt; &lt;/table&gt; &lt;table name="ProPlaceName_tab"&gt; &lt;tuple&gt; &lt;atom name="ProPlaceName"&gt;China&lt;/atom&gt; &lt;/tuple&gt; &lt;/table&gt; &lt;table name="CatOtherNumberType_tab"&gt; &lt;tuple&gt; &lt;atom name="CatOtherNumberType"&gt;Other Number&lt;/atom&gt; &lt;/tuple&gt; &lt;/table&gt; &lt;atom name="DatDateMade"&gt;&lt;/atom&gt; &lt;atom name="DatEarliestDateMadeOrig"&gt;&lt;/atom&gt; &lt;atom name="DatLatestDateMadeOrig"&gt;&lt;/atom&gt; &lt;/tuple&gt; &lt;tuple&gt; &lt;table name="CatObjectName_tab"&gt; &lt;tuple&gt; &lt;atom name="CatObjectName"&gt;Boot&lt;/atom&gt; &lt;/tuple&gt; &lt;/table&gt; &lt;atom name="CatObjectNumber"&gt;2003-39-20B&lt;/atom&gt; &lt;atom name="CatObjectTitle"&gt;&lt;/atom&gt; &lt;table name="CatOtherNumbers_tab"&gt; &lt;tuple&gt; &lt;atom name="CatOtherNumbers"&gt;1895.1.91b&lt;/atom&gt; &lt;/tuple&gt; &lt;/table&gt; &lt;table name="ProPlaceName_tab"&gt; &lt;tuple&gt; &lt;atom name="ProPlaceName"&gt;China&lt;/atom&gt; &lt;/tuple&gt; &lt;/table&gt; &lt;table name="CatOtherNumberType_tab"&gt; &lt;tuple&gt; &lt;atom name="CatOtherNumberType"&gt;Other Number&lt;/atom&gt; &lt;/tuple&gt; &lt;/table&gt; &lt;atom name="DatDateMade"&gt;&lt;/atom&gt; &lt;atom name="DatEarliestDateMadeOrig"&gt;&lt;/atom&gt; &lt;atom name="DatLatestDateMadeOrig"&gt;&lt;/atom&gt; &lt;/tuple&gt; &lt;/ecatalogue&gt; </code></pre> <p>I would like to transform the above into this:</p> <pre><code>&lt;add&gt; &lt;doc&gt; &lt;field name="ProPlaceName"&gt;China&lt;/field&gt; &lt;field name="CatObjectTitle"&gt;&lt;/field&gt; &lt;field name="CatObjectNumber"&gt;2003-39-27A&lt;/field&gt; &lt;field name="CatOtherNumberType"&gt;Other Number&lt;/field&gt; &lt;field name="CatOtherNumbers"&gt;1895.1.117a&lt;/field&gt; &lt;field name="CatObjectName_tab"&gt;Clog&lt;/field&gt; &lt;field name="DatDateMade"&gt;&lt;/field&gt; &lt;field name="DatEarliestDateMadeOrig"&gt;&lt;/field&gt; &lt;field name="DatLatestDateMadeOrig"&gt;&lt;/field&gt; &lt;/doc&gt; &lt;!-- Row 2 --&gt; &lt;doc&gt; &lt;field name="ProPlaceName"&gt;China&lt;/field&gt; &lt;field name="CatObjectTitle"&gt;&lt;/field&gt; &lt;field name="CatObjectNumber"&gt;2003-39-20B&lt;/field&gt; &lt;field name="CatOtherNumberType"&gt;Other Number&lt;/field&gt; &lt;field name="CatOtherNumbers"&gt;1895.1.91b&lt;/field&gt; &lt;field name="CatObjectName_tab"&gt;Boot&lt;/field&gt; &lt;field name="DatDateMade"&gt;&lt;/field&gt; &lt;field name="DatEarliestDateMadeOrig"&gt;&lt;/field&gt; &lt;field name="DatLatestDateMadeOrig"&gt;&lt;/field&gt; &lt;/doc&gt; &lt;/add&gt; </code></pre> <p>Is it best to try and use XSL/XSLT or use something like java or another programming language to make the transformation? How would you approach this problem and can you point me in the right direction?</p> <p>I believe it can be done using XSL. Any help is appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload