This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: comments


Kevin,

Without seeing samples of what you're trying to do, I'm guessing you're
trying to use <xsl:element. . . inside <xsl:comment. . .

Maybe for 
<Fruit>
 <apple>Red</apple>
 <tangerine>Orange</tangerine>
 <grape>White</grape>
</Fruit>

You're trying to do something like
  <xsl:template match="Fruit">
   <xsl:for-each select="*">
    <xsl:comment>
     <xsl:element name="{.}">
      <xsl:value-of select="name()" />
     </xsl:element>
    </xsl:comment>
   </xsl:for-each>
  </xsl:template>

And you're right.  That will produce an error.  <xsl:comment only produces
text nodes

If you have to, you can do this
  <xsl:template match="Fruit">
   <xsl:for-each select="*">
    <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
     <xsl:element name="{.}">
      <xsl:value-of select="name()" />
     </xsl:element>
     <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
    </xsl:for-each>
  </xsl:template>

To get this
<!--<Red>apple</Red>-->
<!--<Orange>tangerine</Orange>-->
<!--<White>grape</White>-->

Bryan

-----Original Message-----
From: Kevin_Gutch@mapinfo.com [mailto:Kevin_Gutch@mapinfo.com]
Sent: Wednesday, September 19, 2001 1:42 PM
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] comments



I want to insert XSL:Elements inside XSL:Comments. I am getting an error
when trying to do this.
Not sure why this isn't acceptable. What is the rule for this? If it is
illegal why? I could manually comment out some elements of an xml without
removing their tags.

Thanks in advance.





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]