I'm getting the following error when trying to do a transform:
Attribute and namespace nodes cannot be added to the parent element after a text, comment, pi, or sub-element node has already been added.
Below is the function I'm using to do the transform
Public Function Transform(ByVal doc As XmlNode, ByVal stylesheet As XmlDocument) As String
Dim trans As XslCompiledTransform = New XslCompiledTransform()
trans.Load(stylesheet)
Dim settings As XmlWriterSettings = New XmlWriterSettings()
settings.OmitXmlDeclaration = False
settings.ConformanceLevel = ConformanceLevel.Fragment
settings.CloseOutput = False
Dim writer As System.IO.StringWriter = New System.IO.StringWriter()
trans.Transform(doc, XmlWriter.Create(writer, settings))
Return writer.ToString()
End Function
Below is the offending code in my xsl
<xsl:template name="Calendar">
<xsl:variable name="dateRef"><xsl:value-of select="@dateRef"/></xsl:variable>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-top: 10px">
<span style="position:absolute; display:none" fieldName="{//Form/@name}.{Name}" initialDate="{@initialDate}" futureBound="{@futureBound}" pastBound="{@pastBound}">
<xsl:attribute name="ID">date<xsl:value-of select="$dateRef"/></xsl:attribute>
</span>
<!-- When I comment out the line below my page loads, but the intended content doesn't -->
<xsl:attribute name="ID">date<xsl:value-of select="$dateRef"/></xsl:attribute>
<xsl:call-template name="calendarContents"/>
</td>
</tr>
</table>
</xsl:template>