Discussion:
XSL transform error with MSXML 6 but not MSXML5 other XSLT process
(too old to reply)
Cecil Ward
2006-08-08 13:54:02 UTC
Permalink
I have executed an XSL transformation successfully using the MSXML 5.0
processor, but repeating the same thing with MSXML 6 gives an error

Error message with MSXML 6 :-
XSLT Transformation Failed - Error : (-2147467259): [A reference to
variable
or parameter 'PageTemplate.Src.Assumed.Path' cannot be resolved. The
variable
or parameter may not be defined, or it may not be in scope.

I wrote a little script to carry out the transformation with either MSXML6
or MSXML5 or MSXML3, and only MSXML 6 gives this error.

As an additional sanity check, I also used the command-line processor NSXLT
written by Oleg Tkachenko to execute the same transformation ( see
http://www.xmllab.net/Products/nxslt2/tabid/73/Default.aspx?PageContentID=10
), a tool that uses the XSLT processor engine in .Net Framework 2.0, and all
was well.

I assumed that perhaps there was something syntactically dubious about the
.xsl source file and that the newer MSXML 6 was simply more strict than MSXML
5, but given the fact that the .net framework 2.0 processor seems happy with
it, that theory seems less likely.


Any suggestions?
--
Cecil Ward
Martin Honnen
2006-08-08 16:40:34 UTC
Permalink
Post by Cecil Ward
I have executed an XSL transformation successfully using the MSXML 5.0
processor, but repeating the same thing with MSXML 6 gives an error
Error message with MSXML 6 :-
XSLT Transformation Failed - Error : (-2147467259): [A reference to
variable
or parameter 'PageTemplate.Src.Assumed.Path' cannot be resolved. The
variable
or parameter may not be defined, or it may not be in scope.
I wrote a little script to carry out the transformation with either MSXML6
or MSXML5 or MSXML3, and only MSXML 6 gives this error.
I assumed that perhaps there was something syntactically dubious about the
.xsl source file and that the newer MSXML 6 was simply more strict than MSXML
5, but given the fact that the .net framework 2.0 processor seems happy with
it, that theory seems less likely.
MSXML 6 for security reasons needs your code to explictly enable certain
settings to have stuff (like DTD parsing or loading included/referenced
resources) working that work by default in older MSXML versions.
That could be one reason why you get different results. Does the
stylesheet you get the error with include and/or import other
stylesheets? Is that param or variable PageTemplate.Src.Assumed.Path
perhaps defined in an included or imported stylesheet?
You need to set
stylesheetDocument.resolveExternals = true
before you load the stylesheet.
See
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/ba3e4d4f-1ee7-4226-a51a-78a1f1b5bd8a.asp>

Of course I am just guessing and there might be a different problem but
you need to provide the XML and the stylesheet then to allow others to
check what makes the difference.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Cecil Ward
2006-08-10 10:19:01 UTC
Permalink
Martin,

That's excellent. That seems to have fixed the error.

Indeed, the stylesheet xsl:includes other stylesheets, and the variable in
question was defined in an included stylesheet. And indeed there was an
external DTD that defines entities, so I missed that.

The error message is completely weird though. If we are saying that no
xsl:include directives ever get processed in msxml6 out-of-the-box, then it
is incredibly unhelpful that it fails to raise an error on seeing an
xsl:include!

To be fair, the documentation is all there, but given the show-stopping
nature of the out-of-the-box backwards compatibility problems (at least for
users whose applications are not using the web), the documents could be fixed
by displaying

i) an MSXML6 "why you should care", health warning up front much more
prominently, and
ii) giving a single cut-n-paste example of “instant backwards-compatibility”
to restore full functionality for designers who are using msxml6 in internal
application situations where exposure to attack simply is not an issue.


Many thanks once again,
--
Cecil Ward
Post by Martin Honnen
Post by Cecil Ward
I have executed an XSL transformation successfully using the MSXML 5.0
processor, but repeating the same thing with MSXML 6 gives an error
Error message with MSXML 6 :-
XSLT Transformation Failed - Error : (-2147467259): [A reference to
variable
or parameter 'PageTemplate.Src.Assumed.Path' cannot be resolved. The
variable
or parameter may not be defined, or it may not be in scope.
I wrote a little script to carry out the transformation with either MSXML6
or MSXML5 or MSXML3, and only MSXML 6 gives this error.
I assumed that perhaps there was something syntactically dubious about the
.xsl source file and that the newer MSXML 6 was simply more strict than MSXML
5, but given the fact that the .net framework 2.0 processor seems happy with
it, that theory seems less likely.
MSXML 6 for security reasons needs your code to explictly enable certain
settings to have stuff (like DTD parsing or loading included/referenced
resources) working that work by default in older MSXML versions.
That could be one reason why you get different results. Does the
stylesheet you get the error with include and/or import other
stylesheets? Is that param or variable PageTemplate.Src.Assumed.Path
perhaps defined in an included or imported stylesheet?
You need to set
stylesheetDocument.resolveExternals = true
before you load the stylesheet.
See
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/ba3e4d4f-1ee7-4226-a51a-78a1f1b5bd8a.asp>
Of course I am just guessing and there might be a different problem but
you need to provide the XML and the stylesheet then to allow others to
check what makes the difference.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Joe Fawcett
2006-08-11 12:03:41 UTC
Permalink
I agree it's annoying but it has to silently ignore xsl:includes rather than
error. It's assuming you have chosen to not allow them rather than you
didn't realise you needed to :)
I also agree the what's new section could do with more emphasis on breaking
changes.
--
Joe Fawcett - XML MVP


http://joe.fawcett.name
Post by Cecil Ward
Martin,
That's excellent. That seems to have fixed the error.
Indeed, the stylesheet xsl:includes other stylesheets, and the variable in
question was defined in an included stylesheet. And indeed there was an
external DTD that defines entities, so I missed that.
The error message is completely weird though. If we are saying that no
xsl:include directives ever get processed in msxml6 out-of-the-box, then it
is incredibly unhelpful that it fails to raise an error on seeing an
xsl:include!
To be fair, the documentation is all there, but given the show-stopping
nature of the out-of-the-box backwards compatibility problems (at least for
users whose applications are not using the web), the documents could be fixed
by displaying
i) an MSXML6 "why you should care", health warning up front much more
prominently, and
ii) giving a single cut-n-paste example of "instant
backwards-compatibility"
to restore full functionality for designers who are using msxml6 in internal
application situations where exposure to attack simply is not an issue.
Many thanks once again,
--
Cecil Ward
Post by Martin Honnen
Post by Cecil Ward
I have executed an XSL transformation successfully using the MSXML 5.0
processor, but repeating the same thing with MSXML 6 gives an error
Error message with MSXML 6 :-
XSLT Transformation Failed - Error : (-2147467259): [A reference to
variable
or parameter 'PageTemplate.Src.Assumed.Path' cannot be resolved. The
variable
or parameter may not be defined, or it may not be in scope.
I wrote a little script to carry out the transformation with either MSXML6
or MSXML5 or MSXML3, and only MSXML 6 gives this error.
I assumed that perhaps there was something syntactically dubious about the
.xsl source file and that the newer MSXML 6 was simply more strict than MSXML
5, but given the fact that the .net framework 2.0 processor seems happy with
it, that theory seems less likely.
MSXML 6 for security reasons needs your code to explictly enable certain
settings to have stuff (like DTD parsing or loading included/referenced
resources) working that work by default in older MSXML versions.
That could be one reason why you get different results. Does the
stylesheet you get the error with include and/or import other
stylesheets? Is that param or variable PageTemplate.Src.Assumed.Path
perhaps defined in an included or imported stylesheet?
You need to set
stylesheetDocument.resolveExternals = true
before you load the stylesheet.
See
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/ba3e4d4f-1ee7-4226-a51a-78a1f1b5bd8a.asp>
Of course I am just guessing and there might be a different problem but
you need to provide the XML and the stylesheet then to allow others to
check what makes the difference.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Satya
2007-01-12 20:58:21 UTC
Permalink
Post by Cecil Ward
I have executed an XSL transformation successfully using the MSXML 5.0
processor, but repeating the same thing with MSXML 6 gives an error
Error message with MSXML 6 :-
XSLT Transformation Failed - Error : (-2147467259): [A reference to
variable
or parameter 'PageTemplate.Src.Assumed.Path' cannot be resolved. The
variable
or parameter may not be defined, or it may not be in scope.
I wrote a little script to carry out the transformation with either MSXML6
or MSXML5 or MSXML3, and only MSXML 6 gives this error.
As an additional sanity check, I also used the command-line processor NSXLT
written by Oleg Tkachenko to execute the same transformation ( see
http://www.xmllab.net/Products/nxslt2/tabid/73/Default.aspx?PageContentID=10
), a tool that uses the XSLT processor engine in .Net Framework 2.0, and all
was well.
I assumed that perhaps there was something syntactically dubious about the
..xsl source file and that the newer MSXML 6 was simply more strict than MSXML
5, but given the fact that the .net framework 2.0 processor seems happy with
it, that theory seems less likely.
Any suggestions?
--
Cecil Ward
Joe,

I would like to know how to set teh below without using MSXML DLLs.

stylesheetDocument.resolveExternals = true

I know we can do below:

objXMLDOMDocument.resolveExternals = boolVal;

Any other alternative solution using C# managed classes....


Thanks

BizTalk Utilities - Frustration free BizTalk Adapters
http://www.topxml.com/biztalkutilities
Rabid Lemming
2009-04-22 12:23:02 UTC
Permalink
toook me ages to work out how to set this in vb 6 code rahter than jscipt

'// Load the XSL Dom with the XSL Stylesheet
Set objXSL = New MSXML2.DOMDocument60
objXSL.resolveExternals = True
objXSL.async = False
objXSL.setProperty "AllowDocumentFunction", True
objXSL.setProperty "AllowXsltScript", True

i hopes this helpes prevent some one else sepnding as long as it took me to
work it out
Rabid Lemming
2009-04-22 12:24:01 UTC
Permalink
it took me ages to work out how to set this in vb 6 code rahter than jscipt

'// Load the XSL Dom with the XSL Stylesheet
Set objXSL = New MSXML2.DOMDocument60
objXSL.resolveExternals = True
objXSL.async = False
objXSL.setProperty "AllowDocumentFunction", True
objXSL.setProperty "AllowXsltScript", True

i hopes this helpes prevent some one else sepnding as long as it took me to
work it out

Loading...