template regions inside attributes?

hawley's Avatar

hawley

20 Jul, 2010 05:54 PM

FYI, to test, I am using system region tags, not content region tags.

Since the templates are XML, you can't put a region tag inside an XML attribute.

This does not pass validation.
<div class="<system-page-title/>"></div>

The region tags are not validated based on string token parsing, but XML parsing and XSL transformation.

For XSL, you can either use the <xsl:value-of/> tag, or the curly bracket notation inside attributes.

This passes validation, but does not expand to the region.
<div class="{system-page-title}"></div>

The reason to do this is so you might use dynamic values for attributes.

It is possible to hack this, but I don't know if it's "The Cascade Way". Also it's not ideal. It involves adding the attribute via format script. There is discussion about this kluge.

  1. Support Staff 1 Posted by Tim on 22 Jul, 2010 03:37 PM

    Tim's Avatar

    I apologize if I'm misunderstanding your question, but if you are looking to dynamically change this particular attribute for your pages, you might be able to do the following:

    • Create a new region in your Template to 'hold' this <div/>
    • Create a 'current page' Index Block and attach it to that region (a 'current page' Index Block is just an Index Block which returns the data from the page you are on and nothing else)
    • Write a Velocity or XSLT Format to transform the Index Block (basically, find the Title in the Index Block XML output and then output the <div/> tag with the Title as the value of the class attribute)

    Let me know if this makes sense.

  2. Tim closed this discussion on 25 Aug, 2010 03:08 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac