32
Use of XSLT Formats in Use of XSLT Formats in Creation, Maintenance Creation, Maintenance and Optimization of and Optimization of Web Site Templates Web Site Templates Jay Mercer Jay Mercer IU Communications IU Communications Indiana University Indiana University [email protected] [email protected]

XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Embed Size (px)

DESCRIPTION

Template Formats are an extremely useful and potentially under-utilized feature of Cascade Server. This presentation will cover the following: 1) A brief recap of basic block/XSLT format functionality, transitioning to an introduction to the use of template formats, describing the similarities and differences with the standard block/format relationship. 2) An in-depth description of how formats can be used to create versatile templates, capable of being easily updated or restructured. Additionally, describing how template formats can be used to solve common template layout issues by enabling movement of page elements during transformation. 3) Finally, a description of how template formats can be used to optimize page creation by streamlining the creation of common page elements, like page title, breadcrumb and page headers by outputting multiple elements using same index block. This presentation is targeted towards attendees with advanced XHTML and XSLT knowledge.

Citation preview

Page 1: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Use of XSLT Formats in Use of XSLT Formats in Creation, Maintenance and Creation, Maintenance and Optimization of Web Site Optimization of Web Site

TemplatesTemplates

Jay MercerJay Mercer

IU CommunicationsIU Communications

Indiana UniversityIndiana University

[email protected]@iu.edu

Page 2: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

TemplateTemplate Formats? Formats?

What are template formats?What are template formats?

Where do I find them?Where do I find them?

When should I use them?When should I use them?

How do I use them?How do I use them?

CaveatsCaveats

Show me some examples!Show me some examples!

Page 3: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Similarity to standard block templatesSimilarity to standard block templates• They transform XML compliant source into HTML.They transform XML compliant source into HTML.

What are template formats?What are template formats?

Page 4: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Similarity to standard block templatesSimilarity to standard block templates• Use a picker to attach to Format field.Use a picker to attach to Format field.

What are template formats?What are template formats?

Page 5: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Difference from standard block templatesDifference from standard block templates• They transform XHTML compliant source into HTML.They transform XHTML compliant source into HTML.• They must be XSLT Formats. (I think)They must be XSLT Formats. (I think)

What are template formats?What are template formats?

Page 6: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Difference from standard block templatesDifference from standard block templates• Use a picker to attach to XSLT Format field of a template.Use a picker to attach to XSLT Format field of a template.

What are template formats?What are template formats?

Page 7: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Template formats are XSLT Formats that are applied to a Template formats are XSLT Formats that are applied to a template.template.• They transform the entire assembled template content.They transform the entire assembled template content.• Region blocks are rendered first. Region blocks are rendered first. • Are used to manipulate XHTML.Are used to manipulate XHTML.• They transform XHTML into XHTMLThey transform XHTML into XHTML• ““Post-processing.”Post-processing.”

What are template formats?What are template formats?

Page 8: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Formats can be applied in 3 places.Formats can be applied in 3 places.• BlocksBlocks• TemplatesTemplates• Page ConfigurationsPage Configurations

Where do I find them?Where do I find them?

Page 9: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Block formatsBlock formats

Where do I find them?Where do I find them?

Page 10: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Template formatsTemplate formats

Where do I find them?Where do I find them?

Page 11: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Page Configuration formatsPage Configuration formats

Where do I find them?Where do I find them?

Page 12: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Always.Always. Modify page elements that exist outside the main content area Modify page elements that exist outside the main content area

from within the DEFAULT system region format.from within the DEFAULT system region format. Move page elements from one position to another. Move page elements from one position to another. Modularize code for reusability.Modularize code for reusability. Implement “on-demand” javascript.Implement “on-demand” javascript. Give end-user greater control.Give end-user greater control. Generate multiple page elements from single block.Generate multiple page elements from single block. Quickly create a new website from existing website.Quickly create a new website from existing website.

When should I use them?When should I use them?

Page 13: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

It all starts with the identity transform.It all starts with the identity transform.

How do I use them?How do I use them?

Page 14: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Attach identity transform to template XSLT format field.Attach identity transform to template XSLT format field.

How do I use them?How do I use them?

Page 15: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Now, just transform the XHTML.Now, just transform the XHTML.• For fun, let’s turn all h3 tags into h4 tags.For fun, let’s turn all h3 tags into h4 tags.

How do I use them?How do I use them?

Page 16: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Note: You can use a template format and a page configuration Note: You can use a template format and a page configuration format together.format together.

How do I use them?How do I use them?

Page 17: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Note: You can use a template format and a page configuration Note: You can use a template format and a page configuration format together.format together.

How do I use them?How do I use them?

Page 18: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Another bogus example.Another bogus example.• Let’s axe the body.Let’s axe the body.

How do I use them?How do I use them?

Page 19: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

DOCTYPEDOCTYPE• A template format WILL remove the DOCTYPE from the output.A template format WILL remove the DOCTYPE from the output.

NamespacingNamespacing• If namespace on the html element is used, special xpath syntax is needed.If namespace on the html element is used, special xpath syntax is needed.

CaveatsCaveats

Page 20: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

DOCTYPE “DON’T”DOCTYPE “DON’T”• A template format will strip out the DOCTYPE.A template format will strip out the DOCTYPE.

CaveatsCaveats

Page 21: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

DOCTYPE “DO”DOCTYPE “DO”• Use the “START-ROOT-CODE” passthrough code section tag.Use the “START-ROOT-CODE” passthrough code section tag.

CaveatsCaveats

Page 22: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Namespacing on html elementNamespacing on html element• If a namespace in used on the html element, special xsl syntax is required.If a namespace in used on the html element, special xsl syntax is required.

CaveatsCaveats

Page 23: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Namespacing on html elementNamespacing on html element• If a namespace in used on the html element, special xsl syntax is required.If a namespace in used on the html element, special xsl syntax is required.

Method 1: Use node()[name()=‘body’] syntaxMethod 1: Use node()[name()=‘body’] syntax

CaveatsCaveats

Page 24: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Namespacing on html elementNamespacing on html element• If a namespace in used on the html element, special xsl syntax is required.If a namespace in used on the html element, special xsl syntax is required.

Method 2: Add namespacing attributes to stylesheet.Method 2: Add namespacing attributes to stylesheet.

CaveatsCaveats

Page 25: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Changing body id based on data definition.Changing body id based on data definition.

ExampleExample

Page 26: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Changing body id based on data definition.Changing body id based on data definition.

ExampleExample

Page 27: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Here’s the xml from the DEFAULT system region.Here’s the xml from the DEFAULT system region.

ExampleExample

Page 28: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Here’s the format from the DEFAULT system region.Here’s the format from the DEFAULT system region.

ExampleExample

Page 29: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Here’s the rendered HTML.Here’s the rendered HTML.

ExampleExample

Page 30: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Here’s the template format.Here’s the template format.

ExamplesExamples

Page 31: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

Final HTML.Final HTML.

ExamplesExamples

Page 32: XSLT Formats in Website Templates in Cascade Server CMS by Jay Mercer

ResourcesResources

• http://www.iu.edu/~pagriet/csuc12/