Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matias 27 posts 68 karma points
    Mar 04, 2013 @ 09:28
    Matias
    0

    Links i media type

    Hallo everyone

    I need some help getting my xslt to work. I have created a media type with a related links property, and now I want this links property to work in my xslt. How to that? I have this code so far:

    The code inside the <a> tag is from the "related links" xslt template cause it is made for document type and not media type (I think).

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <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="mediaId"     select="number($currentPage/topSliderImage)" />
    
        <xsl:if test="$mediaId > 0">
            <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
            <xsl:for-each select="umbraco.library:GetMedia($mediaId, '1')/SliderImage">   
    
                <xsl:variable name="propertyAlias" select="string('sliderImagelink')"/>
    
                            <a>     
    
                                  <xsl:for-each select="$currentPage/* [name() = $propertyAlias and not(@isDoc)]/links/link">
    
                                      <xsl:element name="a">
                                        <xsl:if test="./@newwindow = '1'">
                                          <xsl:attribute name="target">_blank</xsl:attribute>
                                        </xsl:if>
                                        <xsl:choose>
                                          <xsl:when test="./@type = 'external'">
                                            <xsl:attribute name="href">
                                              <xsl:value-of select="./@link"/>
                                            </xsl:attribute>
                                          </xsl:when>
                                          <xsl:otherwise>
                                            <xsl:attribute name="href">
                                              <xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>
                                            </xsl:attribute>
                                          </xsl:otherwise>
                                        </xsl:choose>
                                        <xsl:value-of select="./@title"/>
                                      </xsl:element>
    
                                  </xsl:for-each>
    
    
                            </a>
                        </div>
                        <div class="hd_content_right">
                            <img> 
                                <xsl:attribute name="src"> 
                                    <xsl:value-of select="sliderimageupload" /> 
                                </xsl:attribute> 
                            </img>
                        </div>
                    </div>
                </li>
            </xsl:if>
            </xsl:for-each>
        </xsl:if>
    </xsl:template>
    
    </xsl:stylesheet>

     

    Nothing appears on my side, I think it might have to with the fact that it is not looking in the right place in the second for-each, but I am not sure what to write there. But is it even there the problem is?

  • Matias 27 posts 68 karma points
    Mar 27, 2013 @ 11:51
    Matias
    0

    No ideas here, I could really use some help.

Please Sign in or register to post replies

Write your reply to:

Draft