Hi,
You could loop or you could use a stylesheet. Assuming that your dataset has
a MYDS name and table inside of it has a MYTABLE name. If you would like to
filter on a column ColumnA, then your stylesheet would look like (save it as
Transform.xsl file)
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="/MYDS">
<xsl:element name="MYDS">
<xsl:copy-of select="MYTABLE[ColumnA='AAA']" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Your VB code would look like
Dim loSourceXML As XPath.XPathDocument
Dim loTransform As Xsl.XslTransform
Dim loDataSet As DataSet
Dim loNewDataStream As MemoryStream
Dim loFilteredDataSet As DataSet
loSourceXML = New XPath.XPathDocument(New
StringReader(loDataSet.GetXml()))
loTransform = New Xsl.XslTransform()
loTransform.Load("C:\Transform.xsl")
loNewDataStream = New MemoryStream()
loTransform.Transform(loSourceXML, Nothing, loNewDataStream)
loFilteredDataSet = New DataSet()
loNewDataStream.Position = 0
loFilteredDataSet.ReadXml(loNewDataStream, XmlReadMode.Auto)