Skip to main content

Posts

Showing posts from 2013

XML / XSL Transformation in an ASP.NET Page

If in previous posts I was presenting the greatness of Java when perform XML - XSL transformations, I am attempting now to do the same thing only in ASP.NET and C#. The ASP.NET control that applies XSL templates to XML is called Xml (or <asp:Xml>). In its standard use case, it is very simple to use: specify a DocumentSource attribute pointing to the server location of your XML file; specify a TransformSource attribute indicating the location of the XSL file;     < asp : Xml   DocumentSource ="~/navigation.xml"   TransformSource ="~/breadcrumb.xsl"  runat ="server"   /> The problems however quickly arise -- for example when I use the XML generated by my Navigation TBB , I got error " 'tcm' is an undeclared prefix. Line 1, position 2. ". Obviously, I needed to add the namespace declaration for tcm . My new XML looks like this now: < tcm:ListItems ID = " tcm:1-1-4 " Title = " Root " xmln

Simple XML/XSLT Breadcrumb

This post presents an example on how to transform a navigation XML with a parameterized XSLT in order to produce a simple breadcrumb. Navigation XML The navigation XML is produced using one of the TBBs described in earlier posts: Generate Structure Group Navigation - Recursive TBB ; Generate Structure Group Navigation - GetItems TBB ; Generate Structure Group Navigation - Reorder TBB ;  Navigation XML format: <tcm:ListItems  ID="tcm:1-1-4" Title="Root" >   <tcm:Item ID="tcm:1-2-4" Title="010 About Us" DisplayTitle="About Us" Url="/about-us">     < tcm:Item ID="tcm:1-3-64" Title="010 Who are we?" DisplayTitle="Who are we?" Url="/about-us/who-are-we.html"/ >   </tcm:Item>   < tcm:Item ID="tcm:1-4-64" Title="020 Contact Us" DisplayTitle="Contact Us" Url="/contact-us.html"/ > </tcm:ListItems> Bread

Simple XML/XSLT Navigation

This post presents an example on how to transform a navigation XML with a parameterized XSLT in order to produce a simple site navigation. Navigation XML The navigation XML is produced using one of the TBBs described in my earlier posts: Generate Structure Group Navigation - Recursive TBB ; Generate Structure Group Navigation - GetItems TBB ; Generate Structure Group Navigation - Reorder TBB ;  Navigation XML format: <tcm:ListItems  ID="tcm:1-1-4" Title="Root" >   <tcm:Item ID="tcm:1-2-4" Title="010 About Us" DisplayTitle="About Us" Url="/about-us">     < tcm:Item ID="tcm:1-3-64" Title="010 Who are we?" DisplayTitle="Who are we?" Url="/about-us/who-are-we.html"/ >   </tcm:Item>   < tcm:Item ID="tcm:1-4-64" Title="020 Contact Us" DisplayTitle="Contact Us" Url="/contact-us.html"/ > </tcm:ListItems>

.GetItems() Slower than .GetListItems() - Is It Not?

An old-school Tridion best practice says " whenever possible try to use GetListItems over GetItems due to significant performance degradation on the latter ". Now that might have been very well possible on the old TOM (Tridion Object Model). But is it still the case with TOM.NET? Let's see... In my previous three posts, I have been playing with several ways of generating navigation XML based on Structure Groups and Pages: Generate Structure Group Navigation - GetItems TBB  - gets all SGs and Pages in one call to .GetItems() using a filter with Recursive=true . It then iterates the list of objects and creates an XML document using the hierarchy given by the items' OrganizationalItem property; Generate Structure Group Navigation - Reorder TBB - gets all SGs and Pages in one call to .GetListItems() using a filter with Recursive=true . It then iterates the flat XML, instantiates SG and Page objects using the Engine.GetObject() method, and uses the .Organizationa

Generate Structure Group Navigation - Recursive TBB

This TBB Generates an XML containing all Structure Groups and Pages whose title abides to a naming convention, in hierarchical structure. The naming convention is given by regular expression (e.g. title starts with 3 digits followed by underscore or space). This TBB is available on my Google Code project yet-another-tridion-blog / Template Repository  (file / PT / Navigation / GenerateStructureGroupNavigationRecursive.cs ). Description Name Generate Structure Group Navigation Reorder TBB Type ·     Template in .NET Assembly Description Used to: ·    Generate navigation XML; Notes: This TBB reads the Publication's Root Structure Group and retrieves all child SGs and Pages using the .GetListItems() method in a recursive way. The template retrieves the SG/Pages directly under the given SG and it then iterates each node, invoking a recursive step for each SG it encounters, thus ensuring the entire hierarchical structure is visited. Each SG object is repres

Generate Structure Group Navigation - Reorder TBB

This TBB Generates an XML containing all Structure Groups and Pages whose title abides to a naming convention, in hierarchical structure. The naming convention is given by regular expression (e.g. title starts with 3 digits followed by underscore or space). This TBB is available on my Google Code project yet-another-tridion-blog / Template Repository  (file / PT / Navigation / GenerateStructureGroupNavigationReorder.cs ). Description Name Generate Structure Group Navigation Reorder TBB Type ·     Template in .NET Assembly Description Used to: ·    Generate navigation XML; Notes: This TBB reads the Publication's Root Structure Group and retrieves all child SGs and Pages using the .GetListItems() method. The template reorders each node in the retrieved XML and it places it in a hierarchical structure that matches the SG/Page nesting. Each SG object is represented as a  tcm:Item  node that has potential sub-nodes (other SGs and Pages). The Page objects a