XmlDataSource problem with transformation
am 17.01.2008 10:40:53 von SlawomirI'm trying to use xml with included external files as data source in
xmldatasource control. Unfortunately it doesn't work. Can somebody tell
me what is wrong in this code or what I'm doing wrong? When I'm using
javascript to transform files everything work fine (correct xml is
generated) and when I set it up as data source menu works fine.
Whole solution consists of few files:
main.xml - passed as parameter (data file) to xmldatasource control
trans.xsl - defines transformation, passed as parameter (transform file)
to xmldatasource control
01.xml - first data source file
02.xml - second data source file
doc.js - additional javascript that make the transformation correctly on
my computer. Not used as a part of dataset, just help me to view the
transformation result.
executing sample: cscript doc.xml //NOLOGO >result.xml
When I pass result.xml as data file to xmldatasource menu control works
fine.
main.xml
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
trans.xsl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
01.xml
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
02.xml
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
doc.js
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var sourceFile = ("main.xml");
var styleFile = ("trans.xsl");
// Load the XML.
var source = new ActiveXObject("Msxml2.DOMDocument.5.0");
source.async = false;
source.load(sourceFile);
// Load the XSLT.
var style =new ActiveXObject("Msxml2.DOMDocument.5.0");
style.async = false;
style.load(styleFile);
WScript.Echo(source.transformNode(style));
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
XmlDataSource control code
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EnableViewState="False"
XPath="/*/*" TransformFile="~/test2/trans.xsl">
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Kind Regards,
Slawomir