Click here to Skip to main content
11,930,069 members (44,855 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VB.NET
Hi all,

Newbie to vb so please be gentle....

I am trying to transform some xml using xslcompliedtransform and the xsltargumentlist to another xml file. The file is created, but with only a root element

The main projects.xml file is loaded into a data grid view with some basic details, once a row is clicked, i want to filter the main xml file to create a html report containing all the xml data for the selected entry.

Obviously, not the full correct xml, but is an edited structure...

<?xml version="1.0" encoding="UTF-8"?>
	<Row A1="123456">
		<F49>Project One</F49>
	<Row A1="654321">
		<F49>Project One A</F49>
	<Row A1="223344">
		<F49>Project Two</F49>

The XSL being used:

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:output method="xml" indent="yes" />
<xsl:decimal-format name="NN" NaN="0" />
<xsl:param name="ID" />
<xsl:template match="@* | node()">
<xsl:apply-templates select="/@* | node()" />
<xsl:template match="Root">
<xsl:apply-templates select="Row[@A1=$ID]" />
<xsl:template match="Row">
<xsl:apply-templates select="@A1 | F49 | F48" />

The vb code running on a button click is

Dim oXSL As New XslCompiledTransform()
Dim oXslArg As New XsltArgumentList()
oXslArg.AddParam("ID", "", dgList.Rows(e.RowIndex).Cells(0).Value
oXSL.Transform(New XPathDocument("projects.xml"), XmlWriter.Create(dgList.Rows(e.RowIndex).Cells(0).Value & ".xml"))

The file that is created is

<?xml version="1.0" encoding="utf-8"?><Root />

When running the transformation in XML Notepad or other xml editor, the transform works perfectly....any ideas people? Or any suggestions for a better method?

Many thanks

Posted 18-Dec-12 4:30am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100