Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
How can i say do something if the parent name of the currentNode is 'theParent'. I thought this would work below:
<xsl:choose>
<xsl:when test="$currentPage/parent::node[@nodeName = 'theParent']">
//do this
</xsl:when>
<xsl:otherwise>
/do seomthing else
</xsl:otherwise>
</xsl:choose>
But it doesnt.
Hi Phil,
The logic looks correct to me. Quick check, are you using the new XML schema? (in v4.5+) If so, try this instead:
<xsl:when test="$currentPage/parent::*[@isDoc and @nodeName = 'theParent']">
Cheers, Lee.
Hi Lee, yes thanks this i am using the new schema and your suggestion worked. Where can i read up on the differences with the new schema?
I wrote a blog post about it a while back: http://blog.leekelleher.com/2010/04/02/working-with-xslt-using-new-xml-schema-in-umbraco-4-1/
In a nutshell... for "nodes" the @nodeTypeAlias is now the element name and has a new attribute called "isDoc" ... and for "data", the @alias is now the element name.
As well as Lee's blog post, these are good too
http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/xslt-examples-updated-to-new-schema
http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/no-more-@nodetypealias
Rich
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
if parent name is this, show this...
How can i say do something if the parent name of the currentNode is 'theParent'. I thought this would work below:
<xsl:choose>
<xsl:when test="$currentPage/parent::node[@nodeName = 'theParent']">
//do this
</xsl:when>
<xsl:otherwise>
/do seomthing else
</xsl:otherwise>
</xsl:choose>
But it doesnt.
Hi Phil,
The logic looks correct to me. Quick check, are you using the new XML schema? (in v4.5+) If so, try this instead:
Cheers, Lee.
Hi Lee, yes thanks this i am using the new schema and your suggestion worked. Where can i read up on the differences with the new schema?
Hi Phil,
I wrote a blog post about it a while back: http://blog.leekelleher.com/2010/04/02/working-with-xslt-using-new-xml-schema-in-umbraco-4-1/
In a nutshell... for "nodes" the @nodeTypeAlias is now the element name and has a new attribute called "isDoc" ... and for "data", the @alias is now the element name.
Cheers, Lee.
As well as Lee's blog post, these are good too
http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/xslt-examples-updated-to-new-schema
http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/no-more-@nodetypealias
Rich
is working on a reply...