|
|
Rank: Devotee
Joined: 11/16/2007 Posts: 51
|
I am creating a XSLT file to produce a menu. The menu needs to add "comments" to force IE6/7 to behave. I have entered them into the XSLT but they do not appear in the resulting HTML!? A section of the code is Code: <li class="sub"> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> <!--[if IE 7]><!--></a><!--<![endif]--> <!--[if lte IE 6]><table><tr><td><![endif]--> <ul> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </ul> <!--[if lte IE 6]></td></tr></table></a><![endif]--> </li>
All the bits within <!-- and --> are not rendered. Is there a way to make this stuff appear in the HTML?
Gordon Saxby | Ascend Internet Limited | Web Site Development, Hosting & Domain Names
|
|
 Rank: Umbracoholic
Joined: 7/20/2006 Posts: 1,069 Location: Charleston, West Virginia, United States
|
yes, comments are skipped in xsl. you can use xsl:text to render the tag, or check out xsl:comment. It may render what you want. Code: <xsl:text disable-output-escaping="yes"> <--[if lte IE 6]></xsl:text>...<![endif]--> </xsl:text>
• 2007/2008 MVP • 2008/2009 MVP • Core Developer • Certified Professional Level I & II •
|
|
 Rank: Aficionado
Joined: 1/19/2008 Posts: 147 Location: Belgium
|
neehouse wrote:yes, comments are skipped in xsl. you can use xsl:text to render the tag, or check out xsl:comment. It may render what you want. Code: <xsl:text disable-output-escaping="yes"> <--[if lte IE 6]></xsl:text>...<![endif]--> </xsl:text>
xsl:comment will do the trick
Converting a DotNetNuke site to Umbraco : Follow it here
|
|
Rank: Devotee
Joined: 11/16/2007 Posts: 51
|
Neither xsl:comment or xsl:text work! I tried this Code: <xsl:comment><!--[if IE 7]><!--></xsl:comment> </a> <xsl:comment><!--<![endif]--></xsl:comment>
but it produces this Code: <!----></a><!----><!---->
i.e. the [if IE 7] bit is missing. <xsl:text> does not produce anything.
Gordon Saxby | Ascend Internet Limited | Web Site Development, Hosting & Domain Names
|
|
Rank: Newbie
Joined: 6/5/2008 Posts: 4 Location: Copenhagen
|
xsl:comment and proper escaping of < and > should do it, but if you cannot make it work, try the following: Code:<xsl:text disable-output-escaping="yes"><![CDATA[ <!--[if lte IE 6]><table><tr><td><![endif]--> ]]></xsl:text>
|
|
Rank: Devotee
Joined: 11/16/2007 Posts: 51
|
After a lot of fiddling about, I finally got it working! Code: <li class="sub"> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> <xsl:text disable-output-escaping="yes"><![CDATA[<!--[if IE 7]><!-->]]></xsl:text> </a> <xsl:text disable-output-escaping="yes"><![CDATA[<!--<![endif]-->]]></xsl:text>
<xsl:text disable-output-escaping="yes"><![CDATA[<!--[if lte IE 6]> <table><tr><td> <![endif]-->]]></xsl:text>
<ul> <xsl:call-template name="drawNodes"> <xsl:with-param name="parent" select="."/> </xsl:call-template> </ul>
<xsl:text disable-output-escaping="yes"><![CDATA[<!--[if lte IE 6]> </td></tr></table></a> <![endif]-->]]></xsl:text> </li>
Thanks everyone for your help!
Gordon Saxby | Ascend Internet Limited | Web Site Development, Hosting & Domain Names
|
|
|
Guest |