p***@thomsondigital.com
2010-08-18 10:52:57 UTC
Hello all,
I am trying to comment one of the empty element (<spec/>) in my xml tree
but seems I am missing something.
My stylesheet look something below: <xsl:template match="spec"> <xsl:comment> <xsl:apply-templates select="self::*" mode="comment"/> </xsl:comment> </xsl:template> <xsl:template match="*" mode="comment"> <xsl:value-of select="'<'"/> <xsl:value-of select="name()"/> <xsl:value-of select="'>'"/> <xsl:apply-templates select="@*|node()" mode="comment" /> <xsl:value-of select="'</'"/> <xsl:value-of select="name()"/> <xsl:value-of select="'>'"/>
</xsl:template>
<xsl:template match="text()" mode="comment">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="@*" mode="comment">
<xsl:value-of select="name()"/>
<xsl:text>="</xsl:text>
<xsl:value-of select="."/>
<xsl:text>" </xsl:text>
</xsl:template>
This is what I get using xsltproc (MAC)
Error:
element text
misplaced text element
Any ideas please.
PS: I do have my identity transform defined in stylesheet.
TIA,
Pankaj
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
I am trying to comment one of the empty element (<spec/>) in my xml tree
but seems I am missing something.
My stylesheet look something below: <xsl:template match="spec"> <xsl:comment> <xsl:apply-templates select="self::*" mode="comment"/> </xsl:comment> </xsl:template> <xsl:template match="*" mode="comment"> <xsl:value-of select="'<'"/> <xsl:value-of select="name()"/> <xsl:value-of select="'>'"/> <xsl:apply-templates select="@*|node()" mode="comment" /> <xsl:value-of select="'</'"/> <xsl:value-of select="name()"/> <xsl:value-of select="'>'"/>
</xsl:template>
<xsl:template match="text()" mode="comment">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="@*" mode="comment">
<xsl:value-of select="name()"/>
<xsl:text>="</xsl:text>
<xsl:value-of select="."/>
<xsl:text>" </xsl:text>
</xsl:template>
This is what I get using xsltproc (MAC)
Error:
element text
misplaced text element
Any ideas please.
PS: I do have my identity transform defined in stylesheet.
TIA,
Pankaj
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--