I'm currently running the latest release of Umbraco (4).
I used a lot of nested div tags in my code. We are looking to use Umbraco to simplify our work.
But --- for some odd reason through my testing phase, when I try to use a nested div tag, it removes all internal tags and leaves me with only the external div tag.
Is there a way around this?
Here is an example of some code I was trying just to see:
Can you post the XSLT/macro that generates these divs?
Umbraco by default will not change your divs within a template at all. It's one of it's strengths. If it's generated in an XSLT then there are some things to be aware off. An empty div for instance will render as <div /> which most browsers will not tolerate.
You haven't said where you are entering your code. Is it in a template, or in an XSLT macro?
If it's an XSLT macro, then I suspect this is a 'feature' of the xslt processing that also strips out the closing tag of an empty div tag and add the foward slash into the opening part of the tag:
<div class="clear"></div>
becomes
<div class="clear" />
and this results in an error if you run your html through a validator and prevents styles being applied in some browsers
I use code like this to prevent it:
To prevent Umbraco stripping empty tag elements use CDATA like:
<xsl:text disable-output-escaping="yes"><![CDATA[
<div class="clear"></div>
]]></xsl:text>
If this technique doesn't solve it, please say so, and someone else is sure to chip in.
nested div tags
Hello.
I'm currently running the latest release of Umbraco (4).
I used a lot of nested div tags in my code.
We are looking to use Umbraco to simplify our work.
But --- for some odd reason through my testing phase, when I try to use a nested div tag, it removes all internal tags and leaves me with only the external div tag.
Is there a way around this?
Here is an example of some code I was trying just to see:
<div class="nifty-wrapper">
<div class="nifty-title-box" style="width:460px; margin-bottom:10px; margin-top:10px;">
<div class="nifty-title-left">
<div class="nifty-title-right">
<p class="nifty-title-content">2009 CPMA ANNUAL CONVENTION AND TRADE SHOW HIGHLIGHTS</p>
</div>
</div>
</div>
</div>
Thanks in advance for your assistance.
Stephane
Stephane,
Can you post the XSLT/macro that generates these divs?
Umbraco by default will not change your divs within a template at all. It's one of it's strengths. If it's generated in an XSLT then there are some things to be aware off. An empty div for instance will render as <div /> which most browsers will not tolerate.
DC
Stephane,
You haven't said where you are entering your code. Is it in a template, or in an XSLT macro?
If it's an XSLT macro, then I suspect this is a 'feature' of the xslt processing that also strips out the closing tag of an empty div tag and add the foward slash into the opening part of the tag:
<div class="clear"></div>
becomes
<div class="clear" />
and this results in an error if you run your html through a validator and prevents styles being applied in some browsersI use code like this to prevent it:
To prevent Umbraco stripping empty tag elements use CDATA like:
<xsl:text disable-output-escaping="yes"><![CDATA[
<div class="clear"></div>
]]></xsl:text>
If this technique doesn't solve it, please say so, and someone else is sure to chip in.
Tom
If you cannot use a CDATA section (for example of you still need xslt logic inside the div) you can also insert and xsl:comment inside the div.
This will create an html tag like this
Quite ugly actually, but it works.
Or you could try changing the output method:
This will make the xsl-parser leave your div tags empty, I think.
Regards
.Hauge
is working on a reply...