1
に追加することはできません。エラー:属性と名前空間ノードは、変換を行おうとするとき、私は次のエラーを取得しています親要素
以下Attribute and namespace nodes cannot be added to the parent element after a text, comment, pi, or sub-element node has already been added.
はI変換
を行うために使用している機能です以下は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
私の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>