Mercurial > hg > nginx-site
view xsls/dirname.xsls @ 2942:ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Also xml methods sorted alphabetically,
some descriptions of existing xml methods were updated.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Thu, 23 Feb 2023 13:05:14 +0000 |
parents | be54c443235a |
children |
line wrap: on
line source
<!-- Copyright (C) Igor Sysoev Copyright (C) Nginx, Inc. --> X:stylesheet { <!-- return a dirname of an article link --> X:var DIRNAME = { !dirname (path = "$LINK") } X:template dirname (path) { X:if "contains($path, '/')" { !{ substring-before($path, '/') } X:text {/} !dirname (path = "substring-after($path, '/')") } } <!-- return a path to the root of an article link, i.e., "../../.." --> X:var ROOT = { !root (path = { !{ substring($DIRNAME, 2) } }) } X:template root (path) { X:if "contains($path, '/')" { X:text {..} X:if "substring-after($path, '/')" { X:text {/} !root (path = "substring-after($path, '/')") } } } }