-
-
Save michael-e/1435804 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Not displaying $root --> | |
<xsl:template match="page" mode="url"> | |
<xsl:apply-templates select="parent::page" mode="url"/> | |
<xsl:value-of select="concat(@handle,'/')"/> | |
</xsl:template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Displaying $root, in one template --> | |
<xsl:template match="page" mode="url"> | |
<xsl:apply-templates select="parent::page" mode="url"/> | |
<xsl:if test="not(parent::page)"> | |
<xsl:value-of select="concat($root,'/')"/> | |
</xsl:if> | |
<xsl:value-of select="concat(@handle,'/')"/> | |
</xsl:template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Displaying $root without the if --> | |
<xsl:template match="page" mode="url"> | |
<xsl:value-of select="concat($root,'/',@handle,'/')"/> | |
</xsl:template> | |
<xsl:template match="page/page" mode="url"> | |
<xsl:apply-templates select="parent::page" mode="url"/> | |
<xsl:value-of select="concat(@handle,'/')"/> | |
</xsl:template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment