I want to integrate a basic sitemap in my multilingual site, and it has to be different for all the languages.
My site has this structure:
I want to detect if i'm on a subnode(doesn't matter how deep) of de or en so that i can generate the proper sitemap. Also can a macro be called from another macro in xslt.
<xsl:if test="$currentPage::ancestor-or-self/*/@id = 1000"/> - double check the syntax, but that's the general idea
you can't call another macro from an xslt macro per se, but if you add a reference to another xslt file, you can call templates that are in the referenced xslt file
And you CAN call another macro from xslt, but only if that macro also references a xslt file (not a user control). use umbraco.library:RenderMacro(). Anyway, Euan's suggestion of using includes is preferred in this case.
i have no stats on performance of using includes vs RenderMacro, so wouldn't know. Anyway, think includes is a nicer solution compared to using RenderMacro. Keep one thing in mind (unless that's been solved, it used to be an issue), is if you're changing a xslt that includes another xslt, you need to save both (also the included xslt) before you'd see any changes...
Detecting the branch in a multilingual site
Hello !
I want to integrate a basic sitemap in my multilingual site, and it has to be different for all the languages.
My site has this structure:
I want to detect if i'm on a subnode(doesn't matter how deep) of de or en so that i can generate the proper sitemap. Also can a macro be called from another macro in xslt.
Thanks!
to get which parent node you're under
<xsl:if test="$currentPage::ancestor-or-self/*/@id = 1000"/> - double check the syntax, but that's the general idea
you can't call another macro from an xslt macro per se, but if you add a reference to another xslt file, you can call templates that are in the referenced xslt file
you can use
as a first statement for your sitemap xslt (they will get you to the en or de node) and generate the sitemap starting from that node
Hope this helps.
Cheers,
/Dirk
And you CAN call another macro from xslt, but only if that macro also references a xslt file (not a user control). use umbraco.library:RenderMacro(). Anyway, Euan's suggestion of using includes is preferred in this case.
Cheers,
/Dirk
Wow, you learn something every day :) Is using includes faster than using umbraco.library:RenderMacro()?
i have no stats on performance of using includes vs RenderMacro, so wouldn't know. Anyway, think includes is a nicer solution compared to using RenderMacro. Keep one thing in mind (unless that's been solved, it used to be an issue), is if you're changing a xslt that includes another xslt, you need to save both (also the included xslt) before you'd see any changes...
Cheers,
/Dirk
Wow thanks for both the solutions !
Both worked like a charm :)
Hi andi8u - another approach:
I usually do this in multilingual setups:
- If you don't use a specific Document Type for the root of each site, you can just check the level attribute:
Now you can ask:
or you can just do language-specific stuff:
/Chriztian
is working on a reply...