• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Outputting comments in HTML file

 
Donna Meyer
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a big problem I'm hoping someone can help me with as I have exhausted all my brain cells over it! I have a code-driven HTML display application that uses (believe it or not) comment codes as its code. I now have to convert an XML document to this HTML document outputting these codes also. So I have the following:
<!--code:code--><P>This is an HTML paragraph</P>
I have tried everything from <xsl:text Disable...> to <xsl: text> to <![CDATA[ output. The disabling works, but it views it as a comment and removes it from the HTM doc on output. I have to be able to maintain its display as above.
Please ANY suggestions??
Thanks so much in advance,
Donna
 
Zoe Peng
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did u try to use < or <..to help u out?
try..might work.
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Donna!
There is <xsl:comment> instruction for doing it. In your caase it will be:
<xsl:comment>code:code</xsl:comment><P>This is an HTML paragraph</P>
 
Donna Meyer
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"<" doesn't work and the comment string outputs the those word <xsl:comment>, etc. I have to have this translate exactly ... <!--code:code>. How about some kind of macro? Is there such a thing to call out when needed?
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Donna, how did you get <xsl:comment> in the output? Just curiuos. I am getting <!--code:code--> ...
another variant: <xsl:copy-of>
xml:
<?xml version="1.0"?>
<root>
<!--code:code-->
<P>This is an HTML paragraph</P>
</root>
xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="P">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="comment()">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
output:
<!--code:code-->
<P>This is an HTML paragraph</P>
 
Donna Meyer
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Map,
OH MY WORD! You won't believe what I was doing wrong! I forgot the <xsl: in front & back of the <xsl:comment> code so it was giving me the literal meaning. It isn't actually being used in the XML ... just in the my XSL conversion.
I'm so sorry to have taken up your time with this. However, thanks so much for pointing out the obvious for me with your example or I would probably be bald by tomorrow!
Thanks again,
Donna
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic