XSLT and namespaces in Vertical Site templates
As of version 4.0.7 something good took place. We added the possibility to write templates using Saxon and XSLT 2.0.
Stylesheet version?
If your site just was updated to either 4.0.x or 4.1.x you should re-implement your site using the latest and fastest XSLT transformer. You can easy switch from Xalan to Saxon in both the Page XSL and Object XSL. A little example:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:saxon="http://icl.com/saxon" exclude-result-prefixes="saxon xs" version="2.0"> <xsl:output method="html"/> <xsl:template match="/"> </xsl:template> </xsl:stylesheet>
The new feature lies in version="2.0" in the stylesheet. Vertical Site will use the latest version of Saxon and you will have XSLT 2.0 support in your templates. If you specify version="1.0" Xalan is the current transformator. Xalan has no support for XSLT 2.0.
New namespaces in Vertical Site 4.1.x
Take a look at the example in the previous slide with a little modification:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:saxon="http://icl.com/saxon" xmlns:portal="http://www.enonic.com/cms/xslt/portal" exclude-result-prefixes="saxon xs portal" version="2.0"> <xsl:output method="html"/> <xsl:template match="/"> </xsl:template> </xsl:stylesheet>
With this namespace you have access to our new portal functions for generating google-friendly menues and dynamic path's to content. Just take a look at the navigation on this site.




Comments
If you want to comment on this article you need to be logged in.