Hi! I would like to create and use a macro that inserts a unclosed body-tag with a class-attribute into my templates.
<body class="conditional classes">
I like to have a separate macro for this since several other macros as well as html are building up the rest of the templates.
I can not get it to work. I tried to use cdata to produce my output, but that is escaped to <body ... >, and when I tried <xsl:text disable-output-escaping="yes"><![CDATA[ <body class="members"> ]]></xsl:text> I got nothing?
Thanks for that advice, but then I get an error from umbraco.macro.loadMacroXSLT
Unexpected token '<' in the expression --><<-- body class="members">
I read somewhere else that runat=server in the template tag causes this. But the macro should be inside an contentplaceholder so I need the runat=server afaik.
And inline xslt in template page fields does not seem to work with <xsl:if> or <xsl:choose> should it?
In my template I just would like to get a value from a xslt from within a tag:
<body class="{call xslt to get class names}">
The thing is that I use the same master template from several templates, many templates are used on both member and non-member pages. And we have different classes for the body on member and non-member pages. Phew... :-)
create a un-closed un-escaped <body>-tag
Hi! I would like to create and use a macro that inserts a unclosed body-tag with a class-attribute into my templates.
<body class="conditional classes">
I like to have a separate macro for this since several other macros as well as html are building up the rest of the templates.
I can not get it to work. I tried to use cdata to produce my output, but that is escaped to <body ... >, and when I tried <xsl:text disable-output-escaping="yes"><![CDATA[ <body class="members"> ]]></xsl:text> I got nothing?
Thanks!
I think something like:
<body>
<xsl:attribute name="class">conditional classes</xsl:attribute>
should do it.
Mikael
Hm, yes, but that won't work since the </body> is missing, and the xslt-parser will give me an error. Or am I missing something here?
I just found out about inline xslt in template page fields, and I'm trying to use that approach.
u can use somthing like this <!DOCTYPE xsl:stylesheet [ <!ENTITY body "<body class="YourClass">"> ]>
And then use &body;
Ron
Yuo are right, the XSLT parser don't like missing closing tags.
Thanks for that advice, but then I get an error from umbraco.macro.loadMacroXSLT
Unexpected token '<' in the expression --><<-- body class="members">
I read somewhere else that runat=server in the template tag causes this. But the macro should be inside an contentplaceholder so I need the runat=server afaik.
And inline xslt in template page fields does not seem to work with <xsl:if> or <xsl:choose> should it?
In my template I just would like to get a value from a xslt from within a tag:
<body class="{call xslt to get class names}">
The thing is that I use the same master template from several templates, many templates are used on both member and non-member pages. And we have different classes for the body on member and non-member pages. Phew... :-)
I do not know what I missed but this works:
<body class="<umbraco:Macro Alias='BodyClassMacro' runat='server'></umbraco:Macro>">
And my xslt looks like this:
<xsl:if test="count($currentPage/ancestor-or-self::node[@id = $memberBranchStartNode])=1">memberclass</xsl:if>
Problem solved, thanks for your input.
is working on a reply...