Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6329235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:37:11+00:00 2026-05-24T17:37:11+00:00

I am trying very hard with no luck to take an XML document which

  • 0

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.

I would like to take this XML file and transform it into a Apache Solr format like that below it.

<?xml version="1.0" encoding="UTF-8" ?>
<ecatalogue>
  <tuple>
    <table name="CatObjectName_tab">
      <tuple>
        <atom name="CatObjectName">Clog</atom>
      </tuple>
    </table>
    <atom name="CatObjectNumber">2003-39-27A</atom>
    <atom name="CatObjectTitle"></atom>
    <table name="CatOtherNumbers_tab">
      <tuple>
        <atom name="CatOtherNumbers">1895.1.117a</atom>
      </tuple>
    </table>
    <table name="ProPlaceName_tab">
      <tuple>
        <atom name="ProPlaceName">China</atom>
      </tuple>
    </table>
    <table name="CatOtherNumberType_tab">
      <tuple>
        <atom name="CatOtherNumberType">Other Number</atom>
      </tuple>
    </table>
    <atom name="DatDateMade"></atom>
    <atom name="DatEarliestDateMadeOrig"></atom>
    <atom name="DatLatestDateMadeOrig"></atom>
  </tuple>

  <tuple>
    <table name="CatObjectName_tab">
      <tuple>
        <atom name="CatObjectName">Boot</atom>
      </tuple>
    </table>
    <atom name="CatObjectNumber">2003-39-20B</atom>
    <atom name="CatObjectTitle"></atom>
    <table name="CatOtherNumbers_tab">
      <tuple>
        <atom name="CatOtherNumbers">1895.1.91b</atom>
      </tuple>
    </table>
    <table name="ProPlaceName_tab">
      <tuple>
        <atom name="ProPlaceName">China</atom>
      </tuple>
    </table>
    <table name="CatOtherNumberType_tab">
      <tuple>
        <atom name="CatOtherNumberType">Other Number</atom>
      </tuple>
    </table>
    <atom name="DatDateMade"></atom>
    <atom name="DatEarliestDateMadeOrig"></atom>
    <atom name="DatLatestDateMadeOrig"></atom>
  </tuple>
</ecatalogue>

I would like to transform the above into this:

<add>
    <doc>

        <field name="ProPlaceName">China</field>
        <field name="CatObjectTitle"></field>
        <field name="CatObjectNumber">2003-39-27A</field>
        <field name="CatOtherNumberType">Other Number</field>
        <field name="CatOtherNumbers">1895.1.117a</field>
        <field name="CatObjectName_tab">Clog</field>
        <field name="DatDateMade"></field>
        <field name="DatEarliestDateMadeOrig"></field>
        <field name="DatLatestDateMadeOrig"></field>
    </doc>
  <!-- Row 2 -->
    <doc>
        <field name="ProPlaceName">China</field>
        <field name="CatObjectTitle"></field>
        <field name="CatObjectNumber">2003-39-20B</field>
        <field name="CatOtherNumberType">Other Number</field>
        <field name="CatOtherNumbers">1895.1.91b</field>
        <field name="CatObjectName_tab">Boot</field>
        <field name="DatDateMade"></field>
        <field name="DatEarliestDateMadeOrig"></field>
        <field name="DatLatestDateMadeOrig"></field>
    </doc>
</add>

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?

I believe it can be done using XSL. Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:37:12+00:00Added an answer on May 24, 2026 at 5:37 pm

    Here’s something that should help. It’s fairly simple, and assumes that you are skipping any nested tables…instead only grabbing the atoms within them. It does not sort the fields in any specific order.

    <xsl:template match="/">
        <add>
            <xsl:for-each select="ecatalogue/tuple">
                <doc>
                    <xsl:for-each select=".//atom">
                        <field name="{@name}"><xsl:value-of select="."/></field>
                    </xsl:for-each>
                </doc>
            </xsl:for-each>
        </add>
    </xsl:template>
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm php coder, trying to get into python world, and it's very hard for
I'm trying very hard to figure out a way to parse a string and
I have been trying very hard to achieve rounded corners with IE6+jquery ui tabs.
I'm trying a very basic XPath on this xml (same as below), and it
I am trying a very simple Fluent Nhibernate example: SQL 2005 database with one
i have been trying very hard to make tinyMCE work on my page. even
I am trying very hard to develop a much deeper understanding of programming as
I'm having a very hard time trying to do something very simple. Here's the
I'm having a very hard time trying to access a custom configuration section in
I'm having a very hard time at trying to do trivial things with Visual-generated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.