Can someone please explain why this happens?
The expected output is 3, but uncommenting line 7 makes the output 0.
Why ???
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.Strin gWriter()
Dim xmldoc As New System.Xml.XmlD ocument()
Dim xsldoc As New System.Xml.XmlD ocument()
xmldoc.Load("te st.xml")
xsldoc.Load("te st.xsl")
'xsldoc.LoadXml (xsldoc.OuterXm l)
xsl.Load(xsldoc .CreateNavigato r)
xsl.Transform(x mldoc.CreateNav igator, Nothing, xw)
Console.Write(x w.ToString)
XML input: (test.xml)
<xml>
<node1 val="hello world" />
</xml>
XSL input: (test.xsl)
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="count(d ocument('')//*)" />
</xsl:template>
</xsl:stylesheet>
Please explain why this happens, I do not want to use any file I/O in my
program!
Thanks.
--scott
The expected output is 3, but uncommenting line 7 makes the output 0.
Why ???
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.Strin gWriter()
Dim xmldoc As New System.Xml.XmlD ocument()
Dim xsldoc As New System.Xml.XmlD ocument()
xmldoc.Load("te st.xml")
xsldoc.Load("te st.xsl")
'xsldoc.LoadXml (xsldoc.OuterXm l)
xsl.Load(xsldoc .CreateNavigato r)
xsl.Transform(x mldoc.CreateNav igator, Nothing, xw)
Console.Write(x w.ToString)
XML input: (test.xml)
<xml>
<node1 val="hello world" />
</xml>
XSL input: (test.xsl)
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="count(d ocument('')//*)" />
</xsl:template>
</xsl:stylesheet>
Please explain why this happens, I do not want to use any file I/O in my
program!
Thanks.
--scott
Comment