Applying a custom transform (XSLT)

M

MJB

I've created a button on my form with a VBscript to perform a custom
transform from an XSLT 1.0 file. I'm able to create the DOM object for the
transform and use XDocument.DOM.transformNode to create a string with the
transformation result, but I can't figure out how to apply this into the
XDocument in the form.

My best guess was to use XDocument.DOM.loadXML but I get an error message
that "This DOM cannot be loaded twice". Is there some property of the
XDocument I need to set?

Or, more likely, am I going about this completely wrong? Using InfoPath 2003
and MSXML 5.

Thanks.

Mike.
 
S

S.Y.M. Wong-A-Ton

I did something similar in this article:
http://enterprise-solutions.swits.n...ata-secondary-data-source-xslt&c=infopath2003

Scroll down to the code. While I transformed data in a secondary data
source, the same principles apply. You need to retrieve the parent of the
node in the Main DOM that you want to transform and then replace the old
child node with your transformed XML for the new child node, using
replaceChild().

If you cannot read JScript, replace the "var" with "Dim", remove the
semi-colons, separate the variable declarations and assignments by placing
them on separate lines, and you've got VBScript code.
 
M

MJB

Sorry to take so long to get back to you but other things got in the way.

Thanks for the pointer on how to start with this. After pondering it
further, I realized that InfoPath only supported XSLT 1.0 and I was planning
to use a capability new to XSLT 2.0. So I ended up instead writing a script.
Your example though, turned out to have enough to get me started quickly on
manipulating nodes via the DOM in InfoPath. So I learned what I needed from
your example, even though I had started by asking a different question.

Thanks.

Mike.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top