473,395 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

generate xslt from .net code

5
Hi guys,

I am a new member here and also new to dot net. I am trying to generate XSLT from dot net (C#) code by taking mapping rules from the database.

For example, let's say I have 2 columns in my table representing the 2 XML files, one has the input XML fields and the other has output XML fields.
Like FirstName should be mapped to Fname and LastName should be mapped to lname. So the column 1 has FirstName, LastName and column 2 has Fname and lname.

I need to write a dot net code which may be on the click of a button generates the XSLT to do the above mapping by taking the rules from the database. Any thoughts on how this can be done?

I am taking a look at the XMLTransform methods, in dot net etc. Without hard coding information, how can this be done?

I am relatively new to dot net and XML , just learning, any inputs would be greatly appreciated, at least a starting idea.
I also posted this is dot net forum. Hope there is a savior!!!!
Thanks,

Smidee
Jun 8 '07 #1
7 7018
dorinbogdan
839 Expert 512MB
Welcome to TheScripts TSDN....

You can build XSL code through C# or edit as a text file manually.
But the XSL code depends on your project requirements.
Please take a look at this short tutorial.

God bless you,
Dorin.
Jun 8 '07 #2
smidee
5
Thanks for the prompt reply, but I still did not get an idea how to do it. Let me rephrase my question, Instead of constantly changing the XSLT code manually, each time a new mapping rule comes, I want to programatically be able to generate XSLT based on mapping rules existing in the database as mentioned before.

Like the mapping rules should be taken from the DB and in a C# form , if I click submit button, it should generate the XSLT code for me in a text file or any file.

Just some initial thoughts, or an idea about how to go about this would be great!!

Thanks again,
sd

Welcome to TheScripts TSDN....

You can build XSL code through C# or edit as a text file manually.
But the XSL code depends on your project requirements.
Please take a look at this short tutorial.

God bless you,
Dorin.
Jun 8 '07 #3
dorinbogdan
839 Expert 512MB
There is no standard for it, it's your choice about how to implement the functionality.
I would use a XSL dynamic string built through code, instead of an XSL file.

See also this link and this one.
Jun 11 '07 #4
smidee
5
There is no standard for it, it's your choice about how to implement the functionality.
I would use a XSL dynamic string built through code, instead of an XSL file.

See also this link and this one.

Sorry about the constant questions.
According to what you said, building a dynamic string means writing the whole XSL code as a string and using it. But I do not want to hard code the XSLT, but want to generate it programatically by code using the mapping rules from DB at the click of a button and write it to a text file or XSL file.

Do you know of any dot net API which does this? Please provide some psedo code as a reference if possible.

Thanks a ton,
smidee
Jun 12 '07 #5
dorinbogdan
839 Expert 512MB
Yes, you should write it programatically by code, not hard-code it, so that it will be based at runtime on current rules. I know no API or class that can write XSL code for you. For this, you just must know the rules.
Other solution would be to write one XSL for each rule, if the rules can be predicted / known at design-time.
Jun 12 '07 #6
smidee
5
ok, could you please provide even a 3, 4 lines sample code, even pseudocode, I am not familiar with the dot net capabilities. S

So should I be using the XML APIs in dot net for constructing an XSLT (as XSLT "is" an XML). If you get a chance, a very small sample code or pseudocode would be really useful to understand your point right away. Thanks so much for the help so far!!

Thanks.
Jun 13 '07 #7
dorinbogdan
839 Expert 512MB
I don't have .Net samples, but I think that you could find with google.
Also, Koders is a good source of samples.

peace on you,
Dorin.
Jun 13 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Tim:. | last post by:
Hi Can someone tell me how I generate a new XML file that I can then use with an XSLT file. I am trying to use an XML file generated from Microsoft Project or even better generate an XML file from...
2
by: Nick | last post by:
Hi all, I'm about to embark on a new project and can't decide quite how to do it. In summary, I have a database whose data I want to use to create html pages for a website. The website will just...
4
by: Stephen | last post by:
I need to generate input XML for another application by serialising classes defined in an XSD document. The code below will generate the XML I require but I need to generate this in memory rather...
1
by: tconti | last post by:
Howdy: I have 2 general questions regarding the use of XSLT to generate emails. We have several procecesses that use XSLT to generate emails. We frequently run into issues where a client...
13
by: vm98123 | last post by:
Hi, could someone please give me a clue to this one: I do have an xml-File and an xslt-File so that a browser can display the xml-file. What I am trying to do is convert this to pdf or...
1
by: lennyw | last post by:
Hi I'm trying to use XSLT to do an xml to xml transformation where the output xml contains summary data on the information in the input xml. I've succesfully done a Muenchian grouping of the...
1
by: Daniel Hilgarth | last post by:
Hello, I am currently trying to use XSLT for the creation of multiple HTML-files from a single XML-File. This HTML-files need to have links to each other. The following information might be...
0
by: smidee | last post by:
Hi guys, I am a new member here and also new to dot net. I am trying to generate XSLT from dot net (C#) code by taking mapping rules from the database. For example, let's say I have 2 columns...
5
by: sjangity | last post by:
I am generating xml file that will populate users in a database. assigned_to contains names of developers. reporter contains names of quality engineers. I can't simply just create users...
4
by: Nick | last post by:
I have a critical requirement where I need to club together 4 xml files and display them in an sibngle HTML report. The xmls are generated by Java application by a normal file I/O. Is there a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.