Hello Probocop, Whithout knowing your node structure it is hard to say what XSLT you will need.
But I can try and do something for you here (it assumes that your news folder document type is beneath the home node, and that the news folder contains the items you want to list)
I hope this is of some use to you. If not please post a screenshot of your tree, showing what page you are on and what data you want to retrieve as without knowing your content tree it's hard to help out.
Thanks for the reply. Yes I believe I am after something very similar to what you posted, I've attached a screengrab of my content tree. The page I'm on is the 'Home Page', and I'm trying to grab the nodes created under the 'News' page.
What version of Umbraco are you using? If it is 4.5 and are using the new XML schema then my XSLT will work but obviously updating the documentTypeAliases as needed.
Thanks for the example, I'm not managing to get it working though. I assume I just change the 'newsItemDocTypeAlias' for the alias of the news article alias? (in my case it is 'News Article')
It is giving me the following error:
Error occured
System.Xml.XmlException: The '=' character, hexadecimal value 0x3D, cannot be included in a name. Line 21, position 25. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String[] args) at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper() at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling() at System.Xml.Xsl.Xslt.XsltInput.MoveToFirstChildAny() at System.Xml.Xsl.Xslt.XsltInput.MoveToFirstChild() at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags) at System.Xml.Xsl.Xslt.XsltLoader.XslIf() at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags) at System.Xml.Xsl.Xslt.XsltLoader.XslForEach() at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags) at System.Xml.Xsl.Xslt.XsltLoader.LoadTemplate(NsDecl stylesheetNsList) at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet() at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument() at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
OK looking at your content tree. The "News" node what documet type is it and what is it's alias (found when you edit the document type, as it's not the name of the document type) ?
Thomas, the value of that I suggested will work, its slightly longer but makes it easier to read for beginners to XSLT. i.e the current item in the loop's @nodeName value, however also your way will work and is shorthand once you are more comfortable with XSLT.
Probocop if you are still having issues I recommend that you post your entire XSLT file on here, so that me or Thomas can take a look at it and try and help you out with your problem.
Hello Probocop thanks for providing the XSLT, however I cannot see any problem with the XSLT at all.
So let's check a couple of things (see images)
Please make sure you are using the alias of the document type and not the name, also the document type alias is case sensitive.
It is good practise to give each document type a different icon using the icon drop down when editting the document type, so you can see quicker and easily identify what nodes are when looking at the content tree.
Hello Probocop, the XSLT I wrote will work if you update the aliases correctly.
However your way is still perfectly valid, it's just a longer version of the same thing I done, but as your starting out with XSLT it may be easier for you to read and understand.
Don't forget to mark a reply as an answer to the solution, so that other people can easily find the solution.
Listing subpages of a specific node?
On my homepage I need to list the latest two news articles. How would I go about listing the subpages of a specific node (news page)?
Probocop,
See here http://our.umbraco.org/forum/using/ui-questions/10708-Path-to-Name-not-DocumentType in the drop down select template that lists specific type. I also recommend downloading and installing cws package and that is a great starter kit with plenty of good basic examples.
Regards
Ismail
Hello Probocop,
Whithout knowing your node structure it is hard to say what XSLT you will need.
But I can try and do something for you here
(it assumes that your news folder document type is beneath the home node, and that the news folder contains the items you want to list)
I hope this is of some use to you. If not please post a screenshot of your tree, showing what page you are on and what data you want to retrieve as without knowing your content tree it's hard to help out.
Warren :)
Hi Warren,
Thanks for the reply. Yes I believe I am after something very similar to what you posted, I've attached a screengrab of my content tree. The page I'm on is the 'Home Page', and I'm trying to grab the nodes created under the 'News' page.
Thank you very much for your help!
What version of Umbraco are you using?
If it is 4.5 and are using the new XML schema then my XSLT will work but obviously updating the documentTypeAliases as needed.
Warren
I am running umbraco v 4.0.3 :)
OK so that is the old XML schmea so I can update the example for you
Thanks for the example, I'm not managing to get it working though. I assume I just change the 'newsItemDocTypeAlias' for the alias of the news article alias? (in my case it is 'News Article')
It is giving me the following error:
Error occured
System.Xml.XmlException: The '=' character, hexadecimal value 0x3D, cannot be included in a name. Line 21, position 25.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String[] args)
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper()
at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling()
at System.Xml.Xsl.Xslt.XsltInput.MoveToFirstChildAny()
at System.Xml.Xsl.Xslt.XsltInput.MoveToFirstChild()
at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags)
at System.Xml.Xsl.Xslt.XsltLoader.XslIf()
at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags)
at System.Xml.Xsl.Xslt.XsltLoader.XslForEach()
at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags)
at System.Xml.Xsl.Xslt.XsltLoader.LoadTemplate(NsDecl stylesheetNsList)
at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet()
at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument()
at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
Any idea what's wrong?
Thanks again for your help
OK looking at your content tree.
The "News" node what documet type is it and what is it's alias (found when you edit the document type, as it's not the name of the document type) ?
Warren
Also looking at your error seems there might be an = sign in the wrong place or that quotes are not round the nodetypeAlias
Warren :)
It is that the <= in the position test was converted to <=
also the value of wasn't correct:
try this
hth, Thomas
The <= is ok (was my fault) but the value-of wasn't correct anyway (also just a typo by Warren)
Thomas
Thomas, the value of that I suggested will work, its slightly longer but makes it easier to read for beginners to XSLT.
i.e the current item in the loop's @nodeName value, however also your way will work and is shorthand once you are more comfortable with XSLT.
Warren :)
Probocop if you are still having issues I recommend that you post your entire XSLT file on here, so that me or Thomas can take a look at it and try and help you out with your problem.
Warren
Warren, you wrote
it should be:
so, only a "-" too much but this won't work
I only kicked the current() because of my editor, so you are right this might be better to understand for beginners
Cheers, Thomas
Cheers Thomas,
I missed that typo.Like I said was typing it off the top of my head direct on the forum :)
Thank you both for all your help!
It's not giving me any errors anymore, but it's also not returning anything.
My XSLT file is as following:
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
According to the alias field when editing the News Item doctype, it is 'News Article'
Hello Probocop thanks for providing the XSLT, however I cannot see any problem with the XSLT at all.
So let's check a couple of things (see images)
Please make sure you are using the alias of the document type and not the name, also the document type alias is case sensitive.
It is good practise to give each document type a different icon using the icon drop down when editting the document type, so you
can see quicker and easily identify what nodes are when looking at the content tree.
Warren :)
Hi Warren,
I've actually managed to get it working finally.
Sorry for the confusion on the alias too, the 'News' page has the alias of 'News Page' and the sub pages have the alias of 'newsArticle'
I got it working with the following XSLT:
Hello Probocop, the XSLT I wrote will work if you update the aliases correctly.
However your way is still perfectly valid, it's just a longer version of the same thing I done, but as your starting out with XSLT it may be easier for you to read and understand.
Don't forget to mark a reply as an answer to the solution, so that other people can easily find the solution.
Warren :)
I've marked an answer, thank you very much for your help!
Dave
is working on a reply...