Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rating: Thread Rating: 8 votes, 4.50 average. Display Modes
  #1  
Old 11-23-2006, 11:33 AM
teognost teognost is online now
Registered User
 
Join Date: 05-25-2004
Location: Prague,Czech Republic
Posts: 200
Exclamation Transform XML log action-pass xslt parameters

I need to transform a xml file-therefore I created a 'Transform XML log' action.
In the Transform tab i have put:
-Input file ->xml to be transformed (full path)
-XSLT stylesheet->xslt file (full path)
-Output file->the file resulting after the style was applied(full path)

But xslt file takes 2 parameters -testassembly and profiledassembly:
<xsl:param name="testassembly" />
<xsl:param name="profiledassembly"/>

How can I pass these 2 params into VBP action?
I do not see any place for setting xslt parameters.

Basically I need to implement into VBP this NANT task:
<style style="xsl\AddCoveredAssembly.xslt" in="${ncover.index}" out="${ncover.index}.tmp">
<parameters>
<parameter name="testassembly" value="${testassembly}"/>
<parameter name="profiledassembly" value="${profiledassembly}"/>
</parameters>
</style>
Reply With Quote
  #2  
Old 11-24-2006, 04:29 AM
teognost teognost is online now
Registered User
 
Join Date: 05-25-2004
Location: Prague,Czech Republic
Posts: 200
Could someone pls help me with this...
I need to solve it urgently!!!
Reply With Quote
  #3  
Old 11-24-2006, 12:42 PM
kevina kevina is online now
Registered User
 
Join Date: 03-27-2003
Posts: 825
The Transform XML Log action is written specifically for transforming Visual Build Professional log files, so it probably isn't entirely appropriate for your particular use (the last tab is specific to the xml log format of Visual Build Professional).

Yours is the first request we've received for the ability to more generically transform xml (using dynamic parameter values) but it is a good one which we will consider directly supporting in a future version of Visual Build Professional.

In the meantime, you could use something like the code below as a VBScript function (untested) to do the transform:

Code:
Function TransformXML(xmlFileName, xslFileName, outFileName, parameterNamesValues)
	' pass the parameters as "Name1|Value1,Name2|Value2" etc
	
	Set xml = CreateObject("MSXML2.DOMDocument")
   	xml.async = False
	xml.load xmlFileName

	Set xsl = CreateObject("MSXML2.DOMDocument")
	xsl.async = False
	xsl.load xslFileName

	Set xslt = CreateObject("MSXML2.XSLTemplate")
	Set xslt.stylesheet = xsl
	Set xslProc = xslt.createProcessor()
	xslProc.input = xml
	
	parameters = Split(parameterNameValues, ",")
	If IsArray(parameters) Then
		For i = LBound(parameters) To UBound(parameters)
			param = Split(parameters(i), "|")
			xslProc.addParameter param(0), param(1)
		Next
	End If
	
	xslProc.transform
	Set fout = vbld_FSO.CreateTextFile(outFileName)
	fout.Write xslProc.output
	fout.Close
	
End Function
You could add the above function (untested) as a project or global function, then invoke it in a Run Script step with something like this:

Code:
   TransformXML "xmlfilename", "xslFileName", "outFileName", "param1Name|param1Value,param2Name|param2Value"
You can substitute %MACRONAME% for any of these values in the Run Script step

See the following urls for more info on the above function:
http://msdn.microsoft.com/library/de...25391bbc10.asp
http://p2p.wrox.com/topic.asp?TOPIC_ID=11225
Reply With Quote
  #4  
Old 11-24-2006, 01:47 PM
teognost teognost is online now
Registered User
 
Join Date: 05-25-2004
Location: Prague,Czech Republic
Posts: 200
Thanks a lot for your answer.I already found an workaround-I created a 'Run Program' action where I run a XSLT command line processor made by Microsoft:
msxsl.exe "source.xml" "style.xslt" -o"result.html" "param1=value1" "param2"="value2".
The only problem is I need to install this msxsl.exe on my box,normally I would like to use only VisBuild for such a thing.
The solution proposed by you with VBScript is helpful as well.
However-if this action would be implemented in a future release of VBP-it would be great!!
I think you need just to change a little that 'Transform XML log' action in order to accept parameters.
I used that action for other XSLT transforming and it was ok-of course that XSLT didn't need parameters.
Reply With Quote
  #5  
Old 12-07-2006, 04:06 AM
Francois Francois is online now
Registered User
 
Join Date: 12-06-2006
Posts: 2
I will also vote for a builtin XSLT action.

One thing to consider is to also pass a "MODE" setting to the XSLT processor in addition to the standard parameters. Most of my XSLT templates makes use of "MODE" attribute and I don't know how I managed without it.

Another idea to consider is that parameters can be of type IDispatch. You could for example supply access to your "DOM" for XSLT code to use. I can provide some examples if needed.
Reply With Quote
  #6  
Old 12-21-2009, 10:48 AM
Hess_Joel Hess_Joel is offline
Registered User
 
Join Date: 04-06-2004
Posts: 11
I'd vote for an xslt action too.
Reply With Quote
  #7  
Old 12-21-2009, 10:53 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
http://www.kinook.com/VisBuildPro/Ma...ogparamtab.htm

http://www.kinook.com/Forum/showthre...?threadid=2411
Reply With Quote
  #8  
Old 12-21-2009, 10:56 AM
Hess_Joel Hess_Joel is offline
Registered User
 
Join Date: 04-06-2004
Posts: 11
I don't want to transform the build log though. I have a generated XML file that needs to be converted.
Reply With Quote
  #9  
Old 12-21-2009, 11:00 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
You don't have to transform the build log file.
http://www.kinook.com/VisBuildPro/Ma...ansformtab.htm
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 05:36 PM.


Copyright © 1999-2023 Kinook Software, Inc.