Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Extracting and comparing the pageLink value with current selected page
ssharma48
Hi,
I am trying to retrieve the value of the current page using $PAGELINK[.] and comparing it with the page selected by the user through Navigation.
Based on the select I want to highlight the selected node.
Kindly suggest.
Find more posts tagged with
Comments
Rick Poulin
Edit your post and wrap your XML/XSL in code tags pls.
Not really being able to digest what you posted since it got all garbled even in the source, I'm guessing you have a DATUM of type PAGELINK in your component, and you want to find the equivalent in the navigation tree.
When you read your datums in your component XSL, they will still be in $PAGELINK[mypage] format and not the rendered form. As you noticed, the sitemap XML only contains "mypage" as something to match on. What this means is that your best bet is to substring the value of the pagelink and only get the inner portion of it. You can use XSL functions to do this, e.g.
[HTML]
[/HTML]
At this point, $selectedpage contains "mypage," which you can use to resolve against a node in the sitemap. The above, which is written from memory and untested, assumes that you actually have a $PAGELINK[] style value. You probably want to add additional things to do something smart to handle either blank or static values.
ssharma48
Thank for the reply.
Please find the XML enclosed .
[HTML]
visible-in-sitemap="true">
About Us
SiteMap_test
in-breadcrumbs="true" visible-in-sitemap="true" >
Light Truck
Light Truck
landing-header
[/HTML]
Code snippet :
[HTML]
selected
[/HTML]
If user select "Light Truck" I want to highlight the parent node i.e. "about us" in the navigation.
Note : I am not using a PAGE_LINK as a datum.
Rick Poulin
select="'$PAGE_LINK[.]'"
This won't work because $PAGE_LINK[] and other page tokens aren't interpreted until the page is actually rendered. If you want to know which page you're currently on, it's there by default in the full XML results for any component. I don't recall exactly where, but it's something like <Results currentpage="mypage" > or somesuch. Use the component preview functionality to inspect the XML and find exactly where it is.
ssharma48
Didn't get anything like or something like this in the XML.Also tried from Component Preview functionality to inspect the variable but didn't find that.
Rick Poulin
/Properties/Data/External/Parameters/Datum[
@Name=
'iw-ls-page-name']
With the simplest of components, the above XPath will return the name of the current page, relative to the current site. When you preview a component, the "page context" is the component, which is why that value is the path to the component relative to the workarea. If you put in <xsl:copy-of select="/" /> in your component, and stick it on a page, you'll see that the value is the page path when such context exists.