jhully
asked on
XslTransform works but all 'http' links from XSL file failed
Hello.
I am trying to make some interface to xsl transfromation from C#.
My last function was:
//loads
public static void Transform(ref spXmlDoc, string sXslFile)
{
XmlDocument spXslDoc = new XmlDocument();
XslTransform oXslTransform = new XslTransform();
oXslTransform.Load(sXslFil e);
// thats my function that successfully loads xml files to xmldocument object
XmlUtils.XmlFileLoad(ref spXslDoc, sXslFile);
StringWriter oStringWriter = new StringWriter();
XmlResolver oResolver = new XmlResolver();
oXslTransform.Transform(sp XmlDoc.Doc umentEleme nt, null, oStringWriter, oResolver);
spXmlDoc.LoadXml(oStringWr iter.ToStr ing());
}
So as I meant it works but only for 'local' files called from xsl.
if in the xsl there is something like that:
...
<!-- getting http base address from local files -->
<xsl:variable name="home" select="document('const.xm l')/Consta nts/Addres s" />
<xsl:variable name="ClientProps" select="document(concat($h ome, 'properties.asp'))"/>
...
it's stopping. (I've checked that xsl on XMLSPY 5 Professional, it worked.)
So I'm sure there is something here about resolving url's, credentials and something else. But how to fix it?
I am trying to make some interface to xsl transfromation from C#.
My last function was:
//loads
public static void Transform(ref spXmlDoc, string sXslFile)
{
XmlDocument spXslDoc = new XmlDocument();
XslTransform oXslTransform = new XslTransform();
oXslTransform.Load(sXslFil
// thats my function that successfully loads xml files to xmldocument object
XmlUtils.XmlFileLoad(ref spXslDoc, sXslFile);
StringWriter oStringWriter = new StringWriter();
XmlResolver oResolver = new XmlResolver();
oXslTransform.Transform(sp
spXmlDoc.LoadXml(oStringWr
}
So as I meant it works but only for 'local' files called from xsl.
if in the xsl there is something like that:
...
<!-- getting http base address from local files -->
<xsl:variable name="home" select="document('const.xm
<xsl:variable name="ClientProps" select="document(concat($h
...
it's stopping. (I've checked that xsl on XMLSPY 5 Professional, it worked.)
So I'm sure there is something here about resolving url's, credentials and something else. But how to fix it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Really, yes... But I am still trying to build some more usable and comortable interface. Could we continue after I'll send the points to you?
Hi,
Of course we can, but if the question is answered it's fair to give me the points, right ? :)
Regards
Of course we can, but if the question is answered it's fair to give me the points, right ? :)
Regards
ASKER
You absolutely right
Have a look at this article, i believe it addresses your concern
Secure XSL Transformations in Microsoft .NET
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml07212003.asp
HTH