• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

generate XSLT code dynamically

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all I am trying to solve the below scenario. Please help me at least with a starting idea or some pseudo code for the following:
For a simple example, I have an access database which has 2 columns:

Let's say one column is InputXML and other column is OutputXML that we want.
This contains the mapping rules.
The table structure is as follows:

INPUTXML OUTPUTXML
Fname First Name
Lname Last Name

So basically Fname in input XML should be changed to First Name in output XML. So the database just has the mapping rules for the transformation and not the values.

Now the task is to create an application that has a button called GENERATE XSLT . On clicking this button, it should dynamically generate the XSLT taking the mapping rules from the database. In other words instead of hardcoding the XSLT , based on the DB mapping rules like Fname to FirstName etc, it should just generate the code for XSLT in a txt file or XSL file, which is the code which does the transformation.

So basically an XSLT code generator should be written.

Someone said there is a function call or API which generates the xslt template, I just have to define the relationships among them using values from DB. Not even sure what this means.

Any help on how to approach solving this problem or an idea would be great, I am learning XML/XSLT. If any pseudo code is available , please post.

If you are aware of the API by any chance, please let me know as it will save me some searching time.

Thanks,
Sdee
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See if this discussion helps, ;-)
https://coderanch.com/t/129232/XML/generate-XSL-file-cxml-document
 
Sri Nair
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the time but the discussion does not mention anything about how to generate the XSLT programatically taking the mapping rules from the database. Please let me know if you have some sample code for a simple example.

Thanks though,
Sri
 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sri,

I found the following online tool for XML to XSL generation.

XML to XSL

I havn't tried it extensively but it seems to do the job.

Regards
Naveen Garg
 
Sri Nair
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Naveen,

But there are lots of tools for this and I don;t want a tool, but some code which would generate the XSLT dynamically from the database.

But thanks for that nice tool.
 
Marshal
Posts: 28425
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But what you have described there is a fairly large and complex project. So it just doesn't make sense to ask for code, or even for pseudo-code. There aren't any magic wands for it, if you don't want the tool and you want to write it yourself, then you have to write it yourself. And you already have a high-level description that looks adequate to me, so I don't really know what kinds of ideas you are looking for.

If you had a particular problem you could ask about, that would work better in a forum.
 
reply
    Bookmark Topic Watch Topic
  • New Topic