Not
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Generates a comment in the output.
<xsl:comment>
</xsl:comment>
Element Information
Number of occurrences |
Unlimited |
Parent elements |
xsl:copy, xsl:element, xsl:fallback, xsl:for-each, xsl:if, xsl:message, xsl:otherwise, xsl:param, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements |
Child elements |
xsl:apply-imports, xsl:apply-templates, xsl:call-template, xsl:choose, xsl:copy, xsl:copy-of, xsl:fallback, xsl:for-each, xsl:if, xsl:message, xsl:number, xsl:text, xsl:value-of, xsl:variable |
Remarks
The text generated by the children of <xsl:comment> appears between the starting characters (<!--) and the closing characters (-->).
Example
In the following example, the news.xsl style sheet transforms the news.xml document, and inserts a comment into the XSLT output.
XML File (news.xml)
<?xml version ="1.0"?>
<?xml-stylesheet type="text/xsl" href="news.xsl"?>
<news>
<story1>Here is the top news story.</story1>
<story2> Here is the next news story.</story2>
</news>
XSLT File (news.xsl)
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
<HTML>
<BODY>
<xsl:comment>insert top news story</xsl:comment>
<P>
<xsl:value-of select="//story1"/>
</P>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
Output
This is the formatted output:
Here is the top news story.
This is the processor output:
<HTML> <BODY><!--insert top news story--> <P>Here is the top news story.</P> </BODY> </HTML>