Hi
I'm a totally newbie in umbraco and XSLT, but now i'm able to list subpages and would like to add a image for each subpage.
The subpage documenttype contains a Media Picker property, which hold the image from the media section in umbraco.
My original XSLT goes like this:
Code:<?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"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Don't change this but create a 'number' element in your -->
<!-- macro with the alias of 'numberOfItems' -->
<xsl:variable name="numberOfItems" select="/macro/numberOfItems"/>
<xsl:template match="/">
<!-- The fun starts here -->
<xsl:for-each select="$currentPage/descendant-or-self::node [@nodeTypeAlias = 'dtDog' and string(data [@alias='umbracoNaviHide']) != '1']">
<xsl:if test="position() <= $numberOfItems">
<xsl:call-template name="listpost">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template name="listpost">
<xsl:param name="node"/>
<div class="dogitem">
<h2>
<a href="{umbraco.library:NiceUrl($node/@id)}" rel="bookmark" title="{$node/@nodeName}"><xsl:value-of select="$node/@nodeName"/></a>
</h2>
<xsl:value-of select="$node/data [@alias = 'pIntroText']" disable-output-escaping="yes"/>
</div>
</xsl:template>
</xsl:stylesheet>
The XSLT render correct and display my subpages (see it here:
http://bernercairn.dk/vores-hunde.aspx), but when I add the follwing code in listpost template, I get a XSLT error in the frontend:
Code:<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia($node/data[@alias='pIntroImage'], 'false')/data [@alias = 'umbracoFile'"/>
</xsl:attribute>
</xsl:element>
What am I doing wrong ??
/Anders