Thanks for the suggestion, however it's still not working. I don't think I have a syntax issue, I think something is just not working with my 4.5 installation. This is my second attempt at getting it to work. The first was an upgrade, and this one was a fresh install. I don't get why installing 4.5 would cause this not to work?
In addition to Dirk's answer it might be easier to check the output using <xsl:copy-of select="./@nodeName" /> wrapped in a <textarea> element - it gives you all the XML content and you can easily copy/paste in to a proper editor to see what's going on.
As you can see, there is no output in any of them. The red div borders are the output. I put in a static "value" within the divs just to make sure it was rendering. But none of the xslt suggestions are producing any output except for the first one that is simple doing a <xsl:value-of select="$currentPage/@nodeName"/>. That is the only xslt I can get to work. Something is going on,
I just don't know how to figure out what it is. Any other suggestions would be appreciated. Thanks!
Just to confirm, are you using Umbraco 4.5? Do you know if you are using the new or old XML schema? (or an easier question, is it a fresh install or an upgrade?)
If you are using the new schema - which I believe you are, then the XPath expressions that contain 'node' will not work for you - hence you're frustration! :-)
With the new XML schema, you can pretty much replace all the "node" bits with "*[@isDoc]" - but I suggest that very loosely.
If that still doesn't work, then take a quick look in your /App_Data folder, see if the "umbraco.config" file has any XML inside it. If not, then let us know.
Lee - This is a fresh install of version 4.5 using the new schema. I had guessed that may be my problem. I tried adding the snippet you provided, but it causes errors on save. The error just says "false" when I try and save. Maybe the syntax isn't exactly right?
The umbraco.config in the app_data folder does have xml inside. Thanks for you help!
Hi Lee - Not sure exactly what you meant for me to do, but I put your code in my testing page at http://umbraco4.brainsparkmedia.com/testing.aspx and the following xml was generated from your snippet. Here is the output:
A super-quick overview is that all "node" references can be changed to "*[@isDoc]" ... and "data[@alias='umbracoNaviHide']" can be changed to just "umbracoNaviHide".
Good luck, and if you get suck with anything specific, let us know.
I can't get my root node now that I'm using 4.5?
I can do some things, but not others. For example, this does not work:
<xsl:value-of select="$currentPage/ancestor-or-self::node[last()]/@nodeName"/>
but this does:
<xsl:value-of select="$currentPage/@nodeName"/>
Can anyone tell me why? I've also tried this:
<xsl:value-of select="$currentPage/parent::node/@nodeName"/>
This works fine in my older installs. Can anybody tell me why this doesn't work anymore?
Hi there,
According to the new schema, nodeName still exists, so your XSLT should work. Check out an example of the new schema here.
Hope this helps.
Benjamin
Thanks for the schema, that will be helpful assuming I ever get this to work:)
I just took a look at your XSLT - try this:
<xsl:value-of select="$currentPage/ancestor-or-self::node[position()=last()]/@nodeName"/>
Best,
Benjamin
Thanks for the suggestion, however it's still not working. I don't think I have a syntax issue, I think something is just not working with my 4.5 installation. This is my second attempt at getting it to work. The first was an upgrade, and this one was a fresh install. I don't get why installing 4.5 would cause this not to work?
Hi,
why not do some simple testing to check whether you actually get to the root node, maybe do some "debugging" such as:
and check what output you get and work from there.
Hope this helps.
Regards,
/Dirk
In addition to Dirk's answer it might be easier to check the output using <xsl:copy-of select="./@nodeName" /> wrapped in a <textarea> element - it gives you all the XML content and you can easily copy/paste in to a proper editor to see what's going on.
/Jan
Or just Xml Dump (http://our.umbraco.org/projects/developer-tools/xml-dump) provided by Chriztian Steinmeier to get the xml
Cheers,
/Dirk
Thanks for all the suggestions, I tried them all except for the xmldump. I have a test page here:
http://umbraco4.brainsparkmedia.com/testing.aspx
As you can see, there is no output in any of them. The red div borders are the output. I put in a static "value" within the divs just to make sure it was rendering. But none of the xslt suggestions are producing any output except for the first one that is simple doing a <xsl:value-of select="$currentPage/@nodeName"/>. That is the only xslt I can get to work. Something is going on,
I just don't know how to figure out what it is. Any other suggestions would be appreciated. Thanks!
Hi r_lamb,
Just to confirm, are you using Umbraco 4.5? Do you know if you are using the new or old XML schema? (or an easier question, is it a fresh install or an upgrade?)
If you are using the new schema - which I believe you are, then the XPath expressions that contain 'node' will not work for you - hence you're frustration! :-)
Try this XSLT snippet, see what you get back.
With the new XML schema, you can pretty much replace all the "node" bits with "*[@isDoc]" - but I suggest that very loosely.
If that still doesn't work, then take a quick look in your /App_Data folder, see if the "umbraco.config" file has any XML inside it. If not, then let us know.
Cheers, Lee.
Lee - This is a fresh install of version 4.5 using the new schema. I had guessed that may be my problem. I tried adding the snippet you provided, but it causes errors on save. The error just says "false" when I try and save. Maybe the syntax isn't exactly right?
The umbraco.config in the app_data folder does have xml inside. Thanks for you help!
Hi r_lamb,
Hmmm... strange, not sure what the error could be.
Could you try dumping out the XML from the 'testing' page you posted earlier, and pasting a snippet of the XML here?
So we can see what we're dealing with... just curious now. :-)
Thanks, Lee.
Hi Lee - Not sure exactly what you meant for me to do, but I put your code in my testing page at http://umbraco4.brainsparkmedia.com/testing.aspx and the following xml was generated from your snippet. Here is the output:
<Textpage id="1071" parentID="1057" level="2" writerID="0" creatorID="0" nodeType="1046" template="1070" sortOrder="3" createDate="2010-07-03T10:46:43" updateDate="2010-07-05T09:57:42" nodeName="Testing" urlName="testing" writerName="Administrator" creatorName="Administrator" path="-1,1057,1071" isDoc=""><umbracoNaviHide>0</umbracoNaviHide><headerClass>testing</headerClass><bodyText></bodyText></Textpage>
Hi r_lamb,
Going back to your original question... how do you get to your root node in v4.5?
Try the XPath:
then if you add "/@nodeName" you should get the name of the root node.
... and so forth.
I think our answers/replies got a bit side-tracked. Let us know if there are any misunderstandings.
Cheers, Lee.
Lee, your the man! That got me down the right path. I was using this:
$currentPage/ancestor-or-self::node/@nodeName
And if I switched it to this instead:
$currentPage/ancestor-or-self::*/@nodeName
It worked! I suppose having the @level=1 is needed as well?
So, do I need to be using an asterisk instead of "node"? I'm hardly a xslt expert, so it would be helpful if
someone could help explain the changes I need to make in my xslt. It may not be as simple as looking for node and
replacing it with an asterisk, but if it is, that would be great. Thanks a ton for everyone's help!
There is a wiki article about how to upgrade your XSLT to the new schema:
http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/xslt-examples-updated-to-new-schema
A super-quick overview is that all "node" references can be changed to "*[@isDoc]" ... and "data[@alias='umbracoNaviHide']" can be changed to just "umbracoNaviHide".
Good luck, and if you get suck with anything specific, let us know.
Cheers, Lee.
Yep, that got me going, thanks!
is working on a reply...