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"?><Root>
        <Row A1="123456">
                <F48>Open</F48>
                <F49>Project One</F49>
        </Row>
        <Row A1="654321">
                <F48>Open</F48>
                <F49>Project One A</F49>
        </Row>
        <Row A1="223344">
                <F48>Closed</F48>
                <F49>Project Two</F49>
        </Row></Root>


The XSL being used:


<?xml version="1.0" encoding="UTF-8"?> 

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml" indent="yes" />
<xsl:decimal-format name="NN" NaN="0" />
<xsl:param name="ID" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="/@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="Root">
<xsl:copy>
<xsl:apply-templates select="Row[@A1=$ID]" />
</xsl:copy>
</xsl:template>
<xsl:template match="Row">
<Row>
<xsl:apply-templates select="@A1 | F49 | F48" />
</Row>
</xsl:template>
</xsl:stylesheet>


The vb code running on a button click is


Dim oXSL As New XslCompiledTransform()
oXSL.Load("findProject.xsl")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
 
Graham

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to dotnetdevelopment@googlegroups.com
To unsubscribe from this group, send email to
dotnetdevelopment+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to