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
Hi all,
im trying to get a media item from the media lib via xslt using the new schema, but for some reason it comes back as empty
<?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" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets "><xsl:output method="xml" omit-xml-declaration="yes"/><xsl:param name="currentPage"/><xsl:template match="/"><xsl:variable name="Home" select="$currentPage/ancestor-or-self::* [@level=1]/* [@isDoc and string(umbracoNaviHide) = '1']"/><div id="slider" class="nivoSlider theme-default"> <xsl:for-each select="$Home/Slide"><a><xsl:attribute name="href"><xsl:value-of select="linkUrl"/></xsl:attribute><xsl:variable name="media" select="image"/><xsl:value-of select="$media"/><xsl:if test="$media/umbracoFile"><img src="{$media/umbracoFile}"><xsl:attribute name="title">#caption<xsl:value-of select="position()"/></xsl:attribute></img></xsl:if></a></xsl:for-each></div> <div class="captions"> <xsl:for-each select="$Home/Slide"><div class="nivo-html-caption"><xsl:attribute name="id">caption<xsl:value-of select="position()"/></xsl:attribute><h2><xsl:value-of select="heading"/></h2><p><xsl:value-of select="content"/></p></div> </xsl:for-each> </div> </xsl:template></xsl:stylesheet>
Any help will be greatly appreciated
Hi, can you tell us how you are accessing the media section? Are you using a mediaPicker Type in the back end to access a specific folder in media lib?
Hi Cookie Monster
Do you get any XML returned in your home variable?
try making writing this
<textarea><xsl:copy-of select="$Home" /></textarea>
If the textarea contains any xml, copy it to an editor where you can better view the structure and then see if you're matching the elements correctly.
Hope this helps.
/Jan
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get Media Item
Hi all,
im trying to get a media item from the media lib via xslt using the new schema, but for some reason it comes back as empty
<?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"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="Home" select="$currentPage/ancestor-or-self::* [@level=1]/* [@isDoc and string(umbracoNaviHide) = '1']"/>
<div id="slider" class="nivoSlider theme-default">
<xsl:for-each select="$Home/Slide">
<a>
<xsl:attribute name="href">
<xsl:value-of select="linkUrl"/>
</xsl:attribute>
<xsl:variable name="media" select="image"/>
<xsl:value-of select="$media"/>
<xsl:if test="$media/umbracoFile">
<img src="{$media/umbracoFile}">
<xsl:attribute name="title">#caption<xsl:value-of select="position()"/></xsl:attribute>
</img>
</xsl:if>
</a>
</xsl:for-each>
</div>
<div class="captions">
<xsl:for-each select="$Home/Slide">
<div class="nivo-html-caption">
<xsl:attribute name="id">caption<xsl:value-of select="position()"/></xsl:attribute>
<h2><xsl:value-of select="heading"/></h2>
<p><xsl:value-of select="content"/></p>
</div>
</xsl:for-each>
</div>
</xsl:template>
</xsl:stylesheet>
Any help will be greatly appreciated
Hi, can you tell us how you are accessing the media section? Are you using a mediaPicker Type in the back end to access a specific folder in media lib?
Hi Cookie Monster
Do you get any XML returned in your home variable?
try making writing this
<textarea>
<xsl:copy-of select="$Home" />
</textarea>
If the textarea contains any xml, copy it to an editor where you can better view the structure and then see if you're matching the elements correctly.
Hope this helps.
/Jan
is working on a reply...