Subject: Re: [xsl] Breadcrumbs XSL code From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Wed, 21 Jun 2006 18:01:35 +0530 |
Hi Bernie, Please try this stylesheet:
<xsl:template match="/root"> <html> <head> <title/> </head> <body> <xsl:call-template name="GenerateBreadcrumbs"> <xsl:with-param name="x" select="breadCrumbs" /> <xsl:with-param name="y" select="breadCrumbsUrls" /> </xsl:call-template> </body> </html> </xsl:template>
<xsl:template name="GenerateBreadcrumbs"> <xsl:param name="x" /> <xsl:param name="y" />
<xsl:choose> <xsl:when test="$y != ''"> <xsl:choose> <xsl:when test="contains($y,',')"> <a href="{substring-before($y, ',')}"><xsl:value-of select="substring-before($x, ',')" /></a><xsl:text> </xsl:text> > </xsl:when> <xsl:otherwise> <a href="{$y}"><xsl:value-of select="substring-before($x, ',')" /></a><xsl:text> </xsl:text> > </xsl:otherwise> </xsl:choose> <xsl:call-template name="GenerateBreadcrumbs"> <xsl:with-param name="x" select="substring-after($x, ',')" /> <xsl:with-param name="y" select="substring-after($y, ',')" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$x" /> </xsl:otherwise> </xsl:choose> </xsl:template>
Regards, Mukul
With the next XML:
<?xml version="1.0" encoding="utf-8"?> <root> <breadCrumbs>Home page,Section 1,Chapter2</breadCrumbs> <breadCrumbsUrls>linkToHome.html,linkToSec1.html</breadCrumbsUrls> </root>
can you tell me the XSL code to produce the next HTML?
<a href="linkToHome.html">Home page</a> > <a href="linkToSec1.html">Section 1</a> > Chapter 2
Thank you very much in advance. Bernie
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Breadcrumbs XSL code, Bernie | Thread | [xsl] Can DOCTYPE survive transform, Rick Quatro |
RE: [xsl] XSLT arguments in PHP 5, Buchcik, Kasimier | Date | Re: [xsl] XSLT arguments in PHP 5, Martynas Jusevicius |
Month |