[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Web sites: building common components centrally
Hi,
We (an application service provider CMS (livestoryboard.com) based on XML/XSL.) do something like the following... Each client project usually defines a layouts.xsl[1] that imports several XSLs. The client project can use the applcation defaults for the imports or can extend/override them. You would use (in java) a custom URIResolver to check the client project's dir structure for a file, if not there fallback to the app's default To overrride an import, the client project could either import their own uniquely named xsl file while removing the import for the override or create the file (with the same name as the one to override) in the project's filesystem. To extend an existing imported XSL, the client would create the template they want to override from the default, but still use the default file. For example, head.xsl[2] has a named template that calls other templates. If you want to extend the head.xsl without overriding it completely you could define one of the named templates in the layouts.xsl or some other imported XSL. Hope this makes sense. best, -Rob [1] A layouts.xsl might look like: <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet exclude-result-prefixes="s" version="1.0" xmlns:s="http://livestoryboard.com/schemas/lsb" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- XSL will be looked first relative to this XSL file. If it is not found, the system will lookup an LSB default. If nothing is found it will will return an error (null). --> <xsl:import href="head.xsl"/> <xsl:import href="banner.xsl"/> <xsl:import href="top-level-nav.xsl"/> <xsl:import href="second-level-nav.xsl"/> <xsl:import href="topics.xsl"/> <xsl:import href="footer.xsl"/> <xsl:import href="components/indexer.xsl"/> <xsl:import href="components/metadata.xsl"/> <xsl:import href="components/toc.xsl"/> <xsl:import href="components/pager.xsl"/> <xsl:import href="components/snailtrail.xsl"/> <xsl:import href="content.xsl"/> <xsl:import href="table.xsl"/> <xsl:import href="flash.xsl"/> <xsl:import href="global_definitions.xsl"/> <xsl:import href="metadata_nodesets.xsl"/> <xsl:import href="linking.xsl"/> <xsl:import href="aggregator.xsl"/> <xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" encoding="utf-8" indent="no" method="xml" omit-xml-declaration="yes"/> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <xsl:call-template name="head"/> <body class="{$lsb_folder_nodeset/@name}"> <xsl:choose> <xsl:when test="$user.focus.layout='default'"> <xsl:call-template name="default"/> </xsl:when> <!--<xsl:when test="$user.focus.layout='home'"> <xsl:call-template name="home"/> </xsl:when> <xsl:when test="$user.focus.layout='topics'"> <xsl:call-template name="topics"/> </xsl:when> <xsl:when test="$user.focus.layout='screenshots'"> <xsl:call-template name="screenshots"/> </xsl:when>--> <xsl:otherwise/> </xsl:choose> </body> </html> </xsl:template> <xsl:template name="default"> <xsl:call-template name="banner"/> <xsl:call-template name="tabs"/> <div id="content-main"> <xsl:if test="$lsb_folder_nodeset/@snailtrail"> <xsl:call-template name="snailtrail"/> </xsl:if> <h1> <xsl:value-of select="$focus_title"/> </h1> <xsl:apply-templates mode="load_regions" select="$lsb_folder_metadata/s:regions/s:region[@name='wideColumn']/*"/> <xsl:apply-templates mode="load_regions" select="$lsb_focus_metadata/s:regions/s:region[@name='wideColumn']/*"/> <xsl:if test="$lsb_folder_nodeset/@pager"> <xsl:call-template name="pager"/> </xsl:if> </div> <div id="content-sidebar"> <div id="nav-header"> <xsl:variable name="href"> <xsl:apply-templates select="$lsb_folder_nodeset" mode="get_page_href"/> </xsl:variable> <a href="{$href}"> <xsl:value-of select="$lsb_folder_nodeset/@label"/> </a> <xsl:text>:</xsl:text> </div> <xsl:call-template name="nav"/> <xsl:apply-templates mode="load_regions" select="$lsb_folder_metadata/s:regions/s:region[@name='narrowCol']/*"/> <xsl:apply-templates mode="load_regions" select="$lsb_focus_metadata/s:regions/s:region[@name='narrowCol']/*"/> <br class="brkr"/> </div> <xsl:call-template name="footer"/> </xsl:template> </xsl:stylesheet> [2] head.xsl's main named template:
<xsl:call-template name="head-misc-before"/> <xsl:call-template name="head-css"/> <xsl:call-template name="head-favicon"/> <xsl:call-template name="head-metadata-misc"/> <xsl:call-template name="head-metadata-dc"/> <xsl:call-template name="head-title"/> <xsl:call-template name="head-misc-after"/> </head> </xsl:template> Frans Englich wrote:
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|