6 users online. Create an account or sign in to join them.Users
3/4 Tier Navigation - [Resolved] but feedback appreciated :)
This is an open discussion with 2 replies, filed under General.
Search
small update maybe some XSLT of the sort
<xsl:template match="body//*">
<xsl:choose>
<xsl:when test="name(.) = 'a' and @link!=''">
<a><!-- Create the href in here -->
<xsl:apply-templates/></a>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{name()}">
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
Would you think this is efficient?
<xsl:template match="*" mode="html">
<xsl:element name="{name()}">
<xsl:apply-templates select="* | @* | text()" mode="html"/>
</xsl:element>
</xsl:template>
<xsl:template match="@*" mode="html">
<xsl:choose>
<xsl:when test="name(.) = 'page'">
<xsl:attribute name="href">
<xsl:call-template name='page-link'><xsl:with-param name='id' select='current()'/></xsl:call-template>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
Basically I managed to resolve the issue - for anyone who ever needs a clue the above code should work - not 100% sure about efficiency due to recursion but should not be a major problem since it is only 4 levels deep and will only happen if there are links of that structure. This can be replicated with different sections instead of using page one can use whatever they want.
The template page-link should be a recursive template that creates the required link structure.Blockquote
Create an account or sign in to comment.
Guys,
Currently working to create a new 'website' which I hope to re-package as an ensamble once done that features pages and 3 tier navigation.
Say I have a section called Static Pages that allows static pages to have a parent 'page'. So it would be something like
/about/staff/web/in a previous website I've seen with a similar 3 tier navigation; an extension was used which attaches itself toFrontendOutputPreGenerategrabs a copy of the XML then usesFrontendOutputPostGenerateand replaces all links by doing basically a find-replace function; and using the Datasource XML to extract the page hierarchy.PS for link creation all the links were output from the XSL in the form of
href='#page:123'where 123 is the entry id of the static page.Whilst the above system works I believe it is highly inefficient in fact my bottleneck on this website is XSLT generation. The reason the above was used I assume are the following.
Whilst I can possibly generate basic links using XSLT I am not sure I can apply something of a replace within say a body tag.
I assume something related to a ninja technique to do a match on all links of the sort
<a page='123'>My Anchor</a>and replace with the proper output via an xsl computation would be possible?