I have a situation where I need to write either "<div ...>" or "</div>" depending on a variable (node count / position). If I just put in a couple of IF statements I get an error saying the tag has not been closed. So, is there a "trick" way of doing what I need?
You could also use an empty <xsl:comment /> or even change the output from XML to HTML. But perhaps using the <xsl:comment /> trick is more safe since changing the output to HTML could potentially break other things in the code dependent on the context.
Conditionally write parts of HTML
Using Umbraco 4.6.1 / new schema
I have a situation where I need to write either "<div ...>" or "</div>" depending on a variable (node count / position). If I just put in a couple of IF statements I get an error saying the tag has not been closed. So, is there a "trick" way of doing what I need?
Hola Gordon
You might want to try using the CDATA escaping like this:
Then you shouldn't get any errors when rendering the code.
/Kim A
Thanks Kim - that seems to be working great!
Hi Gordon
You could also use an empty <xsl:comment /> or even change the output from XML to HTML. But perhaps using the <xsl:comment /> trick is more safe since changing the output to HTML could potentially break other things in the code dependent on the context.
/Jan
is working on a reply...