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
Topic author was deleted
Hi,
I am having trouble with looping through all items which have the same tags.
<xsl:for-each select="tags:getEverythingWithTags('test')"> <xsl:value-of select="current()/@nodeName"/> </xsl:for-each><xsl:copy-of select="tags:getEverythingWithTags('test')"/> gives me following output<root><node id="1076" parentID="1057" level="2" writerID="0" sortOrder="7" createDate="2011-01-04T22:18:20" nodeName="Ap" path="-1,1057,1076" /><node id="1077" parentID="1057" level="2" writerID="0" sortOrder="0" createDate="2011-01-04T22:18:40" nodeName="Mt" path="-1,1057,1077" /></root>What am i doing wrong?Thnx
Hi Bart
try changing the value-of to this
<xsl:value-of select="current()/root/node/@nodeName" /> or <xsl:value-of select="current()/node/@nodeName" /> perhaps.
Does this help?
/Jan
Comment author was deleted
Hi Jan,
I get an output wehn i use:
<xsl:for-each select="tags:getEverythingWithTags('test')"> <xsl:value-of select="current()/root/node/@nodeName" /> </xsl:for-each>
but only the first node of the 2 nodes is shown.
<root><node id="1076" parentID="1057" level="2" writerID="0" sortOrder="7" createDate="2011-01-04T22:18:20" nodeName="Ap" path="-1,1057,1076" /><node id="1077" parentID="1057" level="2" writerID="0" sortOrder="0" createDate="2011-01-04T22:18:40" nodeName="Mt" path="-1,1057,1077" /></root>
But in the XML output you posted in the first post you also only got 2 <node> elements returned, right?
Are there more than 2 posts tagged with "test"?...
Just checked the output of <xsl:copy-of select="tags:getEverythingWithTags('test')"/> with the xslt viewer and discoverdthat the node isn't closed correctly
Bart
So there should actually be 3 nodes?
Have you tried to go to the "Content" node and right click it choosing "Republish entire site"? (this updates the XML cache)
Just to make sure that the XML is properly structured. You could also check to see if there is XML in the umbraco.config that is not wellformed.
Hi Bart (& Jan)
The XSLT Visualizer munges the output - you have to wrap a textarea around stuff you copy-of, in order to see the correct output.
It seems you're just getting the tagged nodes wrapped in a root element, which means that you should modify your for-each to something like this:
<xsl:for-each select="tags:getEverythingWithTags('test')/root/node"> <xsl:value-of select="@nodeName"/> </xsl:for-each>
/Chriztian
Hi Chriztian,
That work fine.
Thnx a lot
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Topic author was deleted
for each loop tags library
Hi,
I am having trouble with looping through all items which have the same tags.
<xsl:for-each select="tags:getEverythingWithTags('test')">
<xsl:value-of select="current()/@nodeName"/>
</xsl:for-each>
<xsl:copy-of select="tags:getEverythingWithTags('test')"/> gives me following output
<root><node id="1076" parentID="1057" level="2" writerID="0" sortOrder="7" createDate="2011-01-04T22:18:20" nodeName="Ap" path="-1,1057,1076" /><node id="1077" parentID="1057" level="2" writerID="0" sortOrder="0" createDate="2011-01-04T22:18:40" nodeName="Mt" path="-1,1057,1077" /></root>
What am i doing wrong?
Thnx
Hi Bart
try changing the value-of to this
<xsl:value-of select="current()/root/node/@nodeName" /> or <xsl:value-of select="current()/node/@nodeName" /> perhaps.
Does this help?
/Jan
Comment author was deleted
Hi Jan,
I get an output wehn i use:
<xsl:for-each select="tags:getEverythingWithTags('test')">
<xsl:value-of select="current()/root/node/@nodeName" />
</xsl:for-each>
but only the first node of the 2 nodes is shown.
<root>
<node id="1076" parentID="1057" level="2" writerID="0" sortOrder="7" createDate="2011-01-04T22:18:20" nodeName="Ap" path="-1,1057,1076" />
<node id="1077" parentID="1057" level="2" writerID="0" sortOrder="0" createDate="2011-01-04T22:18:40" nodeName="Mt" path="-1,1057,1077" />
</root>
Hi Bart
But in the XML output you posted in the first post you also only got 2 <node> elements returned, right?
Are there more than 2 posts tagged with "test"?...
/Jan
Comment author was deleted
Hi Jan,
Just checked the output of <xsl:copy-of select="tags:getEverythingWithTags('test')"/> with the xslt viewer and discoverd
that the node isn't closed correctly
<node id="1076" parentid="1057" level="2" writerid="0" sortorder="7" createdate="2011-01-04T22:18:20" nodename="Ap" path="-1,1057,1076">
<node id="1077" parentid="1057" level="2" writerid="0" sortorder="0" createdate="2011-01-04T22:18:40" nodename="Mt" path="-1,1057,1077">
Bart
So there should actually be 3 nodes?
Have you tried to go to the "Content" node and right click it choosing "Republish entire site"? (this updates the XML cache)
Just to make sure that the XML is properly structured. You could also check to see if there is XML in the umbraco.config that is not wellformed.
/Jan
Hi Bart (& Jan)
The XSLT Visualizer munges the output - you have to wrap a textarea around stuff you copy-of, in order to see the correct output.
It seems you're just getting the tagged nodes wrapped in a root element, which means that you should modify your for-each to something like this:
/Chriztian
Comment author was deleted
Hi Chriztian,
That work fine.
Thnx a lot
is working on a reply...