Adding the sitemap to a component through an external

Posted: 1 July 2009 in Components, External, Pages, Site map, SitePublisher, Sites, XSL
Tags: , , , , , ,

As part of your navigation, you probably will have to create your own component. Here’s a crude one that I made.

Content XML

    <Object Scope="local">com.interwoven.livesite.external.impl.LivesiteSiteMap</Object>

Appearance XSL

<xsl:template match="/">
    <div class="navigation"><xsl:apply-templates select="/site-map/segment/node" /></div>
<xsl:template match="node">
            <xsl:attribute name="title"><xsl:value-of select="description" disable-output-escaping="yes" /></xsl:attribute>
                <xsl:when test="link/@type != ''">
                    <xsl:comment><!-- we have a query string to process --></xsl:comment>
                    <xsl:variable name="queryString"><xsl:for-each select="link/query-string/parameter">&amp;<xsl:value-of select="name" />=<xsl:value-of select="value" /></xsl:for-each></xsl:variable>
                        <xsl:attribute name="href"><xsl:choose>
                                <xsl:when test="link/@type = 'page'">/<xsl:value-of select="link/value" />.shtml</xsl:when>
                                <xsl:otherwise><xsl:value-of select="link/value" /></xsl:otherwise>
                            </xsl:choose><xsl:choose><xsl:when test="contains(link/value,'?')"><xsl:value-of select="$queryString" /></xsl:when><xsl:otherwise><xsl:value-of select="substring($queryString,2)" /></xsl:otherwise></xsl:choose>
                            <xsl:when test="link/@target != ''">
                                <xsl:attribute name="target"><xsl:value-of select="link/@target" /></xsl:attribute>
                        <xsl:value-of select="label" disable-output-escaping="yes" />
                        <xsl:comment><!-- unfortunately, we can't process the "preserve query string parameters" instruction in this stylesheet, as it will be used from the development side, not the delivery side --></xsl:comment>
                    <xsl:value-of select="label" disable-output-escaping="yes" />
        <div style="margin-left: 15px">
            <xsl:apply-templates select="node" />

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s