RE: [xsl] comments

Subject: RE: [xsl] comments
From: bryan.s.schnabel@xxxxxxxxxxxxxx
Date: Wed, 19 Sep 2001 16:36:25 -0700
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@xxxxxxxxxxx [mailto:Kevin_Gutch@xxxxxxxxxxx]
Sent: Wednesday, September 19, 2001 1:42 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
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


Current Thread