This makes it easy for you to see what XML is returned, if any. When you know what you get returned it's easier to figure out how to apply the xslt.
Also...what version of Umbraco are you running? If it's 4.5.2 it makes sense that the code does not work, since the XML schema has changed. So unless you have actively changed the Schema to legacy you are running the new schema and then your code needs to be modified accordingly.
Ok, then you're running the new schema. You can change it to run legacy by going to the config folder and open the umbracosettings.config where you can change the schema.
But actually I'll recommend you to use the new schema.
Try to create XSLT macro and choose one of the predefined templates and study the code in there.
And then try to look at the XML output you get from the copy-of - then I think you'll soon figure out how to fetch the info.
If you can't at all get your head around it, just let us know :)
How to list news pages?
Hello..
I'm currently using this:
<xsl:variable name="pressNodes" select="umbraco.library:GetXmlNodeById(1106)/node [string(data [@alias='umbracoNaviHide']) != '1']"/>
<!-- The fun starts here -->
<ul>
<xsl:for-each select="$pressNodes">
<xsl:sort select="@updateDate" order="descending"/>
<xsl:if test="position() <= $numberOfItems">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:if>
</xsl:for-each>
But i can't get it to work.
What i want it to do is, to list alle the child-pages to News (id 1106)
Whats wrong with the code?
Hi Jesper
try writing this in your file
<textarea><xsl:copy-of select="$pressNodes" /></textarea>
This makes it easy for you to see what XML is returned, if any. When you know what you get returned it's easier to figure out how to apply the xslt.
Also...what version of Umbraco are you running? If it's 4.5.2 it makes sense that the code does not work, since the XML schema has changed. So unless you have actively changed the Schema to legacy you are running the new schema and then your code needs to be modified accordingly.
/Jan
Hi Jan
It is 4.5.2 i'm running?
So all the code needs to be replaced?
Hi Jesper
Ok, then you're running the new schema. You can change it to run legacy by going to the config folder and open the umbracosettings.config where you can change the schema.
But actually I'll recommend you to use the new schema.
Try to create XSLT macro and choose one of the predefined templates and study the code in there.
And then try to look at the XML output you get from the copy-of - then I think you'll soon figure out how to fetch the info.
If you can't at all get your head around it, just let us know :)
/Jan
Hmm.. When i select the List sub pages by date and limit I get this:
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
And that lists all my pages. My strukture is as:
Side 1
Side 2
Side 3
News
- News 1
- News 2
So I will need to read only the News sub pages.
Hi
I did'nt mean you should just rely on the out of box functionality. The principle you used in the posted code is the same. The syntax is different.
Try this out
<xsl:variable name="pressNodes" select="umbraco.library:GetXmlNodeById(1106)/* [@isDoc and string(umbracoNaviHide) != '1'"/>
<!-- The fun starts here -->
<ul>
<xsl:for-each select="$pressNodes">
<xsl:sort select="@updateDate" order="descending"/>
<xsl:if test="position() <= $numberOfItems">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:if>
</xsl:for-each>
Be aware that you'll also need a variable called "numberOfitems" - if you want to list all of the news then just remove the <xsl:if></xsl:if>
Hope this helps
/Jan
Well.. I have tried that, but i must have messed the code up, because it's working now :)
Thanks!!
is working on a reply...