Subject: Dynamic XML Scripts
Posted By: IrishJoker Post Date: 8/30/2006 5:06:03 AM
Hi,

I'm in a bit of a pickle to say the least.
I've come up with an idea which I'd like to implement, but haven't a clue how to go about doing such a thing.

Basically what I want to do is have an XML script, but certain parts of the script will need to be mapped to a Database field.

So here's a sample of my XML File.

<script>
    <question>
        <name>
            Dear #FirstName#
        </name>
    </question>
    <question>
        <name>
            Dear Mr. #Surname#
        </name>
    </question>
    </script.


So what I need to do is to have the parts #FirstName# and #Surname# updated to the customer actual first and second name. I'll have an ID for the customer in the database which I'll need to use.

So has anyone any ideas on how to achieve this...

I thought that XSLT might have the answer...

Thanks,

Eoin...

Reply By: joefawcett Reply Date: 8/30/2006 5:14:15 AM
XSLT does not have built-in database facilities, two alternative approaches come to mind:
 
  • Set up a web service to return some XML that has the user's details based on the id given. You can then use the document function to access this data and incorporate it in your output.

  • Use the extension functionality, e.g. using .NET you can write C# code to call into a database from within a transform.  


If you still have problems let us know what XML library you are using and whether the web service is a possibility or you can only access via traditional database interfaces.

--

Joe (Microsoft MVP - XML)
Reply By: IrishJoker Reply Date: 8/30/2006 5:33:12 AM
Hi Joe,

Thanks for the quick reply.

I'll most likely be using the extension functionality in .Net.
The scripts will be displayed on an ASP.Net page, and I'll be using VB.Net for the behind code.

Do you have any examples, or can you point me in the right direction.

Thanks again,

Eoin...

PS What is the Document function that you speak of, I'm not too sure what you mean...

Go to topic 49051

Return to index page 190
Return to index page 189
Return to index page 188
Return to index page 187
Return to index page 186
Return to index page 185
Return to index page 184
Return to index page 183
Return to index page 182
Return to index page 181