Need some quick help, having a child node see the parent node media ID...
I have set up some jQuery using innerfade and have it working great on the parent pages, I would like the child pages to inherit it. I have set up the xslt as follows....
I thought that I had to change the [code]<xsl:variable name="MediaRootId" select="$currentPage/data [@alias = 'MediaRoot']"/>[/code] line to allow ancestors-and-self, but that does not seem to make any difference, what am i missing?
As I understand you you have a content hierachy where a node has a media picker to select a media folder. On the subpages you also want to show the images selected by the media picker of the ancestor node.
If so and the content node with the media picker is on a defined level just do something like this:
Need some quick help, having a child node see the parent node media ID...
I have set up some jQuery using innerfade and have it working great on the parent pages, I would like the child pages to inherit it. I have set up the xslt as follows....
[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" 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:variable name="MediaRootId" select="$currentPage/data [@alias = 'MediaRoot']"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:if test="$MediaRootId != '' ">
<!-- just added as cast-workaround -->
<ul id="rotate">
<xsl:for-each select="umbraco.library:GetMedia($MediaRootId, 'false')/node">
<li>
<xsl:if test="@nodeTypeAlias='Image'">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="data [@alias = 'umbracoFile']"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
[/code]
I thought that I had to change the [code]<xsl:variable name="MediaRootId" select="$currentPage/data [@alias = 'MediaRoot']"/>[/code] line to allow ancestors-and-self, but that does not seem to make any difference, what am i missing?
wow that did not work at all.... here it is...
<?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:variable name="MediaRootId" select="$currentPage/data [@alias = 'MediaRoot']"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:if test="$MediaRootId != '' ">
<!-- just added as cast-workaround -->
<ul id="rotate">
<xsl:for-each select="umbraco.library:GetMedia($MediaRootId, 'false')/node">
<li>
<xsl:if test="@nodeTypeAlias='Image'">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="data [@alias = 'umbracoFile']"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
</li>
<!-- Add other <td> entries here to display further info -->
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
As I understand you you have a content hierachy where a node has a media picker to select a media folder. On the subpages you also want to show the images selected by the media picker of the ancestor node.
If so and the content node with the media picker is on a defined level just do something like this:
Or if the content node with the media picker has a defined nodeTypeAlias just do:
You have to select the node with media picker via ancestor-or-self::node and some filtering to select the exakt node
hth,
Thomas
is working on a reply...