You're probably just posting a small snippet of the real code, but just in case you're not:
The link has no content so no clickable text/content will show up (OK, cheap shot - I know :-)
When you save this, you'll likely get errors because your XSLT is tested against the "Content" node, which has no ancestor element named "node", neither is it called "node" itself, so the call to NiceUrl() fails with something like "Value was either too large or too small for an Int32. at System.Convert.ToInt32(Double value)"
So you'll need to perform a test for the property value OR check the Skip testing (ignore errors) checkbox when saving (!).
Anyone see whats wrong with this?
Hi can anyone see whats wrong with this, i get errors in it, but it looks ok to me!
<a href="{umbraco.library:NiceUrl($currentPage/ancestor-or-self::node/data[@alias='caseStudyLink1'])}"></a>
Hi Vincent,
Have you checked the value of the XPath? It could be that it's empty, or not numeric?
Cheers, Lee.
Hi Vincent,
You're probably just posting a small snippet of the real code, but just in case you're not:
So you'll need to perform a test for the property value OR check the Skip testing (ignore errors) checkbox when saving (!).
/Chriztian
A couple fo theories I haven't tested:
- according to this documentation ancestor-or-self could be bringing back multiple nodes if they have the caseStudyLink1 alias.
- And you may have to explicitly use the @id attribute within niceURL as it expects an Int
Sometimes I have had luck by putting the whole Xpath in a variable, and then include the variable in the href. Like this:
<xsl:variable name="link" select="umbraco.library:NiceUrl($currentPage/ancestor-or-self::node/data[@alias='caseStudyLink1'])}"/>
You could try it out...
/Kim A
is working on a reply...