Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Moving from MSXML to .NET - document('') doesn't work?

From: roxscott@-----------.---------.---
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>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent