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
This...
<table cellpadding="0" cellspacing="0" style="width: 453px;"> <xsl:for-each select="umbraco.library:GetXmlNodeById('1126')/Area"> <xsl:sort select="//omrdenavn" /> <tr> <td class="tableListItem"> <h2> <a> <xsl:attribute name="href">/Search.aspx?name=<xsl:value-of select="//name"/></xsl:attribute> <xsl:value-of select="//name"/></a> </h2> <a class="imgLink"> <xsl:attribute name="href">/Search.aspx?name=<xsl:value-of select="//name"/></xsl:attribute> <img src="/media/73/blackspace.jpg" alt="" class="img220" /></a> <p> <xsl:value-of select="Exslt.ExsltStrings:padding('140', //description)"/>...<br /> <a> <xsl:attribute name="href">/Search.aspx?name=<xsl:value-of select="//name"/></xsl:attribute> Læs mere om <xsl:value-of select="//name"/></a> </p> </td> </tr> </xsl:for-each> </table>
...is somehow not working!!! Well, I get something: The same data 2 times! Any comments? Thank you.
Hey,
What is the structure of your data?
At first glance, I would say it is to do with the '//' at the begining of your selectors, as that will fetch any matches.
Bit dificuilt to pin point it exactly without an idea of data structure though.
Matt
The structure is as follows:
Area 1 is the one that is being repeated. Area 2 isn't viewed at all.
I have added your advise (get rid of the first slash), but the result is the same.
Hi Webspas,
I concur with Matt, that you need to tell us about your data, but a surefire way to mess up your output is to use the // (descendant) axis...
Try this for starters and see where that gets you:
<table cellpadding="0" cellspacing="0" style="width: 453px;"> <xsl:for-each select="umbraco.library:GetXmlNodeById('1126')/Area"> <xsl:sort select="omrdenavn" /> <tr> <td class="tableListItem"> <h2> <a href="Search.aspx?name={name}"> <xsl:value-of select="name" /> </a> </h2> <a class="imgLink" href="/Search.aspx?name={name}"> <img src="/media/73/blackspace.jpg" alt="" class="img220" /> </a> <p> <xsl:value-of select="Exslt.ExsltStrings:padding('140', description)" />...<br /> <a href="/Search.aspx?name={name}"> <xsl:text>Læs mere om </xsl:text> <xsl:value-of select="name" /> </a> </p> </td> </tr> </xsl:for-each> </table>
/Chriztian
Hey! Solved! I deleted both slashes and now it works! Thanks!
Hey Webspas,
Chriztians example above should do the trick then, assuming 1126 is the id of the "Countries" node.
If 1126 is the id of the "Areas" node, you should just be able to change the following line
<xsl:for-each select="umbraco.library:GetXmlNodeById('1126')//Area">
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
This loop is driving me nuts!
This...
<table cellpadding="0" cellspacing="0" style="width: 453px;">
<xsl:for-each select="umbraco.library:GetXmlNodeById('1126')/Area">
<xsl:sort select="//omrdenavn" />
<tr>
<td class="tableListItem">
<h2>
<a>
<xsl:attribute name="href">/Search.aspx?name=<xsl:value-of select="//name"/></xsl:attribute>
<xsl:value-of select="//name"/></a>
</h2>
<a class="imgLink">
<xsl:attribute name="href">/Search.aspx?name=<xsl:value-of select="//name"/></xsl:attribute>
<img src="/media/73/blackspace.jpg" alt="" class="img220" /></a>
<p>
<xsl:value-of select="Exslt.ExsltStrings:padding('140', //description)"/>...<br />
<a>
<xsl:attribute name="href">/Search.aspx?name=<xsl:value-of select="//name"/></xsl:attribute>
Læs mere om <xsl:value-of select="//name"/></a>
</p>
</td>
</tr>
</xsl:for-each>
</table>
...is somehow not working!!! Well, I get something: The same data 2 times! Any comments? Thank you.
Hey,
What is the structure of your data?
At first glance, I would say it is to do with the '//' at the begining of your selectors, as that will fetch any matches.
Bit dificuilt to pin point it exactly without an idea of data structure though.
Matt
The structure is as follows:
Area 1 is the one that is being repeated. Area 2 isn't viewed at all.
I have added your advise (get rid of the first slash), but the result is the same.
Hi Webspas,
I concur with Matt, that you need to tell us about your data, but a surefire way to mess up your output is to use the // (descendant) axis...
Try this for starters and see where that gets you:
/Chriztian
Hey! Solved! I deleted both slashes and now it works! Thanks!
Hey Webspas,
Chriztians example above should do the trick then, assuming 1126 is the id of the "Countries" node.
If 1126 is the id of the "Areas" node, you should just be able to change the following line
Matt
is working on a reply...