• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Outputting comments in HTML file

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did u try to use < or <..to help u out?
try..might work.
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic