Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Moving from MSXML to .NET - document('') doesn't work? [Thread Next] RE: Moving from MSXML to .NET - document('') doesn't work?To: NULL Date: 11/5/2004 12:51:00 PM I have finally boiled this down to one line of code...
Can someone explain why this happens?
VB.NET code: ** note the commented line, this is the culprit **
Dim xsl As New System.Xml.Xsl.XslTransform()
Dim xw As New System.IO.StringWriter()
Dim xmldoc As New System.Xml.XmlDocument()
Dim xsldoc As New System.Xml.XmlDocument()
xmldoc.Load("test.xml")
xsldoc.Load("test.xsl")
'xsldoc.LoadXml(xsldoc.OuterXml)
xsl.Load(xsldoc.CreateNavigator)
xsl.Transform(xmldoc.CreateNavigator, Nothing, xw)
Console.Write(xw.ToString)
XML input: (test.xml)
<xml>
<node1 val="hello world" />
</xml>
XSL input: (test.xsl)
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:template match="/">
<xsl:value-of select="count(document('')//*)" />
</xsl:template>
</xsl:stylesheet>
Please explain why this happens, I do not want to use any file I/O in my
program!
Thanks.
--scott
"rox.scott" wrote:
> I am porting all code from MSXML4 to .NET parser.
>
> It appears that XPath Document() function is not working anymore ?!?!
>
> I am passing empty string as the parameter to search within the current XSL
> document:
> e.g (in this example, $cvf is always empty):
>
> <xsl:template name="conversion">
> <!-- unit conversion table -->
> <units>
> <convert from="ppm" to="ppt">1000000</convert>
> <convert from="ppm" to="oz/ton">0.029167</convert>
> <convert from="ppm" to="mg/kg">1</convert>
> <convert from="ppb" to="ppm">0.001</convert>
> <convert from="g" to="mg">1000</convert>
> <convert from="ppm" to="g/tonne">1</convert>
> <convert from="ppm" to="%">0.0001</convert>
> ...
> <xsl:variable name="cvf">
> <xsl:value-of select="document('')//units/convert[@from=$f and @to=$t]"/>
> </xsl:variable>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
