I'm having an issue looping through a folder of nodes to display in a list of items on a page. Here's my code and explanation of what I'm trying to achieve below:
So from a destination page I have a folder below it (nodeName = Venues) with items in there (nodeTypeAlias = Venue), but keep getting the old error, Error parsing XSLT file,
Pulling my hair out for the last 3 hours, any help very gratefully received!
Put ?umbDebugShowTrace=True in the URL for that page and find the (hopefully) detailed error description (should be bright red somewhere down the page).
(Also: You say it's Venues/Venue - but your code looks for Venue/Venues - was that a typo?)
Morten, it's happening when rendered on the website.
Chriztian, I've tried appending ?umbDebugShowTrace=True to the url but get nothing, no sure why though? Also my typo not in the code but my explanation, so the code is referencing the correct nodes.
Error when for looping
Hello all,
I'm having an issue looping through a folder of nodes to display in a list of items on a page. Here's my code and explanation of what I'm trying to achieve below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
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" xmlns:yorkshire.library="urn:yorkshire.library"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets yorkshire.library ">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:for-each select="$currentPage/node[@nodeName='Venue']/node[@nodeTypeAlias='Venues']">
<div class="Venue">
<div class="DestinationLeft">
<div class="VenueName"><a href="{umbraco.library:NiceUrl(current()/@id)}"><xsl:value-of select="data [@alias = 'venueName']" disable-output-escaping="yes" /></a></div>
<div class="VenueAddress">
<xsl:value-of select="data [@alias = 'Address1']" disable-output-escaping="yes" />,
<xsl:value-of select="data [@alias = 'TownCity']" disable-output-escaping="yes" />,
<xsl:value-of select="data [@alias = 'Postcode']" disable-output-escaping="yes" /></div>
<div class="VenueShortDesc"><p><xsl:value-of select="data [@alias = 'shortDesc']" disable-output-escaping="yes" /></p></div>
</div>
<div class="DestinationRight">
<a href="{umbraco.library:NiceUrl(current()/@id)}">
<xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/venueImage, 0)" />
<xsl:if test="string($media) !='' ">
<img src="{$media/umbracoFile}" width="278" height="215" />
</xsl:if>
</a>
</div>
</div>
<p><img src="/images/venues/linedash.png" width="598" height="6" alt="" /></p>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
So from a destination page I have a folder below it (nodeName = Venues) with items in there (nodeTypeAlias = Venue), but keep getting the old error, Error parsing XSLT file,
Pulling my hair out for the last 3 hours, any help very gratefully received!
Cheers
Pete
Do you get the error when saving, or when it's rendered on the website?
Hi Pete,
Put ?umbDebugShowTrace=True in the URL for that page and find the (hopefully) detailed error description (should be bright red somewhere down the page).
(Also: You say it's Venues/Venue - but your code looks for Venue/Venues - was that a typo?)
/Chriztian
Thanks for your responses guys.
Morten, it's happening when rendered on the website.
Chriztian, I've tried appending ?umbDebugShowTrace=True to the url but get nothing, no sure why though? Also my typo not in the code but my explanation, so the code is referencing the correct nodes.
Cheers
Pete
Hi Pete,
The ?umbDebugShowTrace thing only works if the key umbracoDebugMode in web.config is true
I'd suspect the error is caused by the call to GetMedia() - it looks as if you're using the "new Schema" syntax for that particular line:
(You're also looking on $currentPage for every one of them which you probably don't mean to...)
The rest of your code uses the old schema, so you should do this instead (and throw in a null-check too):
/Chriztian
Perfect! thanks Chriztian, that's worked! Many thanks for help and time.
Cheers
Pete
is working on a reply...