xsl help- simple..I think

Results 1 to 2 of 2

Thread: xsl help- simple..I think

  1. #1
    Join Date
    Dec 1969

    Default xsl help- simple..I think

    Hi..the following vb.net code simply uses an xml doc as a database...<BR>1)it loads the name.xml file into a dataSet<BR>2)binds it to a datagrid<BR>3)adds a new row ever time the button is click and writes the name.xml doc<BR><BR>Problem: name.xml is associated with an xsl file, once name.xml is view in my browser the doc is formated according my my xsl; however when my code below writes the name.xml doc it does not include this line in the name.xml file:<BR>&#060;?xml-stylesheet type="text/xsl" href="names.xsl"?&#062;<BR>Many thanks in advance!<BR> <BR><BR> Private Sub btnOne_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOne.Click<BR> &#039;create DataSet object<BR> Dim objDataSet As New DataSet()<BR><BR> &#039;read in xml doc<BR> objDataSet.ReadXml(Server.MapPath("name.xml"))<BR> <BR><BR> &#039;bind xml doc to data grid<BR> dg.DataSource = objDataSet.Tables("customer").DefaultView<BR> dg.DataBind()<BR><BR> &#039;add a new row to the table<BR> Dim objTable As DataTable<BR> Dim objNewRow As DataRow<BR><BR> objTable = objDataSet.Tables("customer")<BR> objNewRow = objTable.NewRow()<BR> objNewRow.Item("firstName") = "Larry"<BR> objNewRow.Item("lastName") = "Doe"<BR> objTable.Rows.Add(objNewRow)<BR><BR> &#039;save to file<BR> objDataSet.WriteXml(Server.MapPath("name.xml"))<BR ><BR> End Sub

  2. #2
    Join Date
    Dec 1969

    Default RE: xsl help- simple..I think

    My guess is that AFTER you save the document, you&#039;ll have to manually load the XML file and add the processing instruction (&#060;?xml-stylesheet...?&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts