Setting output method to html will make xslt generate html instead of xml elements, this generally will not cause you any issues if you expect html, however, it will also force a tag like <br/> to be rendered as <br> so that will not be valid xhtml.
So if steen and kiposoep doesn't have real problems to tell you about ;) then I'm pretty confident it will solve your problem considering the snippet you posted
It's a workaround indeed, I always use <xsl:comment /> which will then output <!-- --> for you so that the tag cannot auto-close AND I do not have the risk of a stray space screwing up my layout.
You can't apply it to the xsl:template tag, you have to apply it to individual elements that need preserving of whitespace
You would still have to remember to put some whitespace there in the first place, most of the time I just get a blob of html from the frontend designer and they haven't put spaces in there (which is actually a good thing). So you're back to square one.
XSLT totally ruins my design
I'm tring to make a sort of dynamic breadcrumb with XSLT. But until now it tottaly ruins my design. It's like it doesn't close all the tags correctly.
On my template I have:
<div id="divTopWrap">
<div id="divBreadcrumb">
<div style="clear: left; margin-top: -4px;">
<div class="breadcrumbItem">
Her er du:
</div>
<div class="breadcrumbItem">
<a href="/Forside">Forside</a>
</div>
<umbraco:Macro Alias="DynamicBreamcrumb" runat="server"></umbraco:Macro>
<div class="breadcrumbItem">
<span class="breadcrumbCurrent"><xsl:value-of select="pageTitle"/></span>
</div>
</div>
</div>
</div>
In the XSLT I have some more...
<div class="breadcrumbItem">
<a href="#">Dropdown 1 here</a>
</div><div class="breadcrumbItem">
<a href="#">Dropdown 2 here</a>
</div>
I have validated my css, and there is no errors.
But still it is like XSLT smash it. Anyone who have an idea of what to do?
What does the html output look like ??
xslt merges all empty tags so
becomes <div></div> becomes <div/>
change the output to html instead of xml:
Thank you!
That might give you some other issues, but if it solves your problem....
Problems... Like what?
XSLT is evil ;-)
Setting output method to html will make xslt generate html instead of xml elements, this generally will not cause you any issues if you expect html, however, it will also force a tag like <br/> to be rendered as <br> so that will not be valid xhtml.
So if steen and kiposoep doesn't have real problems to tell you about ;) then I'm pretty confident it will solve your problem considering the snippet you posted
@Per
:O :O :O
Real problems?! Lol :D
XSLT == evil. Whatever output you choose, it fails anyway :P
@kipusoep, the problem must be somewhere else: http://www.amazon.com/XSLT-Dummies-Richard-Wagner/dp/0764536516 ;-)
Haha okay, then tell me how I should tell XSLT not to output <div /> out of <div></div> without using <div> </div> hack.
Whilst <br /> won't be transformed to <br>... :D
...is a bit better then <div> </div> because it's considered an empty tag by browsers.
It's even valid XHTML when used in an <ul> while is not allowed,
Sounds like a hack/work-around to me ;-)
It's a workaround indeed, I always use <xsl:comment /> which will then output <!-- --> for you so that the tag cannot auto-close AND I do not have the risk of a stray space screwing up my layout.
That or use xml:space="preserve" in the xsl:template tag, then white-spaces will be left in the output, that way a <div> </div> wont end up as<div />
I don't ever do html output in the solutions I make, everything is xhtml these days, so output="html" really isn't an option for me.
There's two problems with preserving whitespace:
is working on a reply...