Copied to clipboard

Flag this post as spam?

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


  • Vincent DeCapite 64 posts 83 karma points
    Oct 28, 2010 @ 14:13
    Vincent DeCapite
    0

    Multi-Media Picker Issue

    Hi All,

    I am trying to figure out this issue I have with the multi-media picker. What I am trying to do is for the user to attach a bunch of PDF's or word docs to the multi-media picker. In return i need it to out put a link for each document on the webpage that say ABC..

    The code that I have tried so far is this that I found in another post and tweaked:

    <xsl:variable name="docs" select="$currentPage/data[@alias='documentList']"/>
    <xsl:if test="$docs != ''">
    <xsl:variable name="splitDocs" select="umbraco.library:Split($docs, ',')" />
    <ul><xsl:for-each select="$splitDocs/value"><xsl:if test=". != ''">
    <xsl:variable name="mediaNode" select="umbraco.library:GetMedia(.,0)"/>
    <xsl:if test="$mediaNode != ''">
    <li>
    <a href="{$mediaNode/data [@alias='umbracoFile']}">
    <xsl:value-of select="$mediaNode/@nodeName"/>
    </a>
    </li>
    </xsl:if>
    </xsl:if>
    </xsl:for-each>
    </ul></xsl:if>

    When I do the visualize XSLT button the links are popping up, but they do not output on the page.

    Any help would be greatly appreciated.

  • Rich Green 2246 posts 4008 karma points
    Oct 28, 2010 @ 14:48
    Rich Green
    0

    I can't see much wrong with your code to be honest.

    Do you get the <li>'s in your output?

    Rich

  • Vincent DeCapite 64 posts 83 karma points
    Oct 28, 2010 @ 14:55
    Vincent DeCapite
    0

    Hi Rich,

    Thanks for the quick reply... I do not get anything when I save this or add the documents. Nothing appears on the screen. The only time I get the links to the documents is when I do the Visualize XSLT thing in umbraco behind the scenes. If I just select that Piece of code then I get the PDF's.

    Here is the whole template:

    <?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:wsc.library="urn:wsc.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:tagsLib="urn:tagsLib"
     exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib wsc.library">


    <xsl:output method="html" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:variable name="inputCat" select="umbraco.library:Request('cat')" />
    <xsl:variable name="inputSub" select="umbraco.library:Request('sub')" />
    <xsl:variable name="inputProduct" select="umbraco.library:Request('prod')" />


    <xsl:template match="/">
    <xsl:if test="$currentPage/@nodeTypeAlias = 'Product'">
     <xsl:variable name="queryString" select="umbraco.library:RequestServerVariables('QUERY_STRING')" />
        <xsl:variable name="urlRaw" select="concat(umbraco.library:Replace(umbraco.library:NiceUrl($currentPage/data [@alias='productCategory']//item[@alias = 'productCategory']), '.aspx', concat('/', $currentPage/@urlName, '.aspx')), '')" />
        <xsl:variable name="url">
            <xsl:value-of select="$urlRaw" />
         <xsl:if test="$queryString != ''">
          <xsl:text>?</xsl:text>
                <xsl:value-of select="$queryString" />
            </xsl:if>
        </xsl:variable>

        <xsl:value-of select="wsc.library:Redirect($url, 'True')" />
     
        [[Redirect - <xsl:value-of select="$url" />]]
    </xsl:if>


    <xsl:value-of select="umbraco.library:RegisterJavaScriptFile('JQueryToolsJS', 'http://cdn.jquerytools.org/1.2.2/all/jquery.tools.min.js')" />
    <xsl:value-of select="umbraco.library:RegisterJavaScriptFile('ProductJS', '/inc/js/product.js')" />

    <xsl:variable name="product" select="$currentPage/ancestor-or-self::root//node [@nodeTypeAlias = 'Product' and @urlName = $inputProduct]" />

    <style type="text/css">
    .breadcrumb { display: none; }
    </style>
    <div class="breadcrumb" style="display: block;">
        <xsl:for-each select="$currentPage/ancestor-or-self::node [@level &gt; 0 and string(data [@alias='umbracoNaviHide']) != '1']">
           <a href="{umbraco.library:NiceUrl(@id)}">
              <xsl:choose>
                    <xsl:when test="./data [@alias='pageNavigationName'] != ''">
                        <xsl:value-of select="./data [@alias='pageNavigationName']" />
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="@nodeName"/>
                    </xsl:otherwise>
                </xsl:choose>
           </a>
           <xsl:text> / </xsl:text>
        </xsl:for-each>
        <span>
              <xsl:value-of select="$product/data [@alias = 'productName']" />
        </span>
    </div>
    <div id="product">

    <h1><xsl:value-of select="$product/data [@alias = 'productName']" /></h1>
    <div class="images">
     <xsl:if test="$product/data [@alias = 'productImages'] != ''">
     <xsl:variable name="images" select="umbraco.library:GetMedia($product/data [@alias = 'productImages'], 'true')//node [data [@alias = 'umbracoFile'] != '']" />
         <img src="/umbraco/imagegen.ashx?width=200&amp;image={$images/data[@alias = 'umbracoFile']}" id="productImage" />
            <xsl:if test="count($images) &gt; 1">
            <div class="thumbs">
      <xsl:for-each select="$images">
             <a href="/umbraco/imagegen.ashx?width=200&amp;image={data [@alias = 'umbracoFile']}" class="thumb"><span class="mask"><img src="/umbraco/imagegen.ashx?width=46&amp;image={data [@alias = 'umbracoFile']}" /></span></a>
            </xsl:for-each>
            </div>
            </xsl:if>
     </xsl:if>
    </div>

    <div class="description">
        <xsl:value-of select="$product/data [@alias = 'bodyText']" disable-output-escaping="yes" />
       
        <div class="productInfo">
            <h2>Product Information <span>click to download</span></h2>
      <!--
            <xsl:if test="number($product/data [@alias = 'productVideo']) or number($product/data [@alias = 'productAnimation'])">
            <ul class="links">
             <xsl:if test="number($product/data [@alias = 'productVideo'])">
                 <li><a href="#" rel="{$product/data [@alias = 'productVideo']}" class="button video"><span><span>video</span></span></a></li>
                </xsl:if>
             <xsl:if test="number($product/data [@alias = 'productAnimation'])">
                 <li><a href="#" rel="{$product/data [@alias = 'productAnimation']}" class="button video"><span><span>animation</span></span></a></li>
                </xsl:if>
      </ul>
            </xsl:if>
            -->
            <xsl:if test="$product/data [@alias = 'productVideos'] != ''">
            <ul class="links">
             <li><a href="#" rel="{$product/@id}" class="button video"><span><span>video and animation</span></span></a></li>
      </ul>
            </xsl:if>
           
            <xsl:variable name="files" select="wsc.library:GetXmlString($product/data [@alias = 'productDocuments'])" />
            <!--[[<xsl:copy-of select="$files" />]]-->
            <ul class="links">
             <!-- Files -->
                <xsl:for-each select="$files//document">
                <xsl:sort select="@name" order="ascending" />
                    <xsl:variable name="fileID" select="@id" />
                    <!--[[<xsl:value-of select="@name" />, <xsl:value-of select="@alias" />, <xsl:value-of select="$fileID" />]]-->
                    <xsl:if test="number($fileID)">
                        <xsl:variable name="file" select="umbraco.library:GetMedia($fileID, 'False')" />
                        <!--[[<xsl:copy-of select="$file" />]]-->
                        <xsl:if test="$file//data [@alias = 'umbracoFile'] != ''">
                            <xsl:call-template name="fileLink">
                                <xsl:with-param name="name" select="@name" />
                                <xsl:with-param name="file" select="$file" />
                            </xsl:call-template>
                     </xsl:if>
                    </xsl:if>
                </xsl:for-each>

                <xsl:if test="$product/data [@alias = 'productResourcePage'] != ''">
                 <li><a href="{$product/data [@alias = 'productResourcePage']}" target="_blank">Resource Page</a></li>
                </xsl:if>
               

    <xsl:variable name="docs" select="$currentPage/data[@alias='documentList']"/>
    <xsl:if test="$docs != ''">
    <xsl:variable name="splitDocs" select="umbraco.library:Split($docs, ',')" />
    <ul><xsl:for-each select="$splitDocs/value"><xsl:if test=". != ''">
    <xsl:variable name="mediaNode" select="umbraco.library:GetMedia(.,0)"/>
    <xsl:if test="$mediaNode != ''">
    <li>
    <a href="{$mediaNode/data [@alias='umbracoFile']}"> test
    <xsl:value-of select="$mediaNode/@nodeName"/>
    </a>
    </li>
    </xsl:if>
    </xsl:if>
    </xsl:for-each>
    </ul></xsl:if>

     


            </ul>
        </div>
    </div>
    <!--
    <xsl:variable name="icons" select="umbraco.library:Split($product/data [@alias = 'productIcons'], ',')//value" />
    <xsl:if test="count($icons) &gt; 0">
    <div class="icons">
     <xsl:for-each select="$icons">
         <img src="/elements/skin/product/icons/{umbraco.library:Replace(current(), ' ', '_')}.gif" alt="{current()}">
             <xsl:attribute name="alt">
                 <xsl:choose>
                     <xsl:when test="current() = 'International availability'">
                         <xsl:text>International Orders Only</xsl:text>
                        </xsl:when>
                        <xsl:otherwise>
                         <xsl:value-of select="current()" />
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:attribute>
            </img>
        </xsl:for-each>
    </div>
    </xsl:if>
    -->
    <xsl:variable name="variants" select="$product//node [@nodeTypeAlias = 'ProductVariant']" />
    <xsl:if test="count($variants) &gt; 0">
    <div class="specs">
     <h2>Specifications</h2>
        <!--[[<xsl:copy-of select="$variants" />]]-->
        <!--<xsl:variable name="columns" select="wsc.library:GetXmlString($variants[position()=1]/data [@alias = 'productSpecs'])//spec" />-->
        <table>
         <!--
            <tr>
             <th>Product Number</th>
                <xsl:if test="count($columns[@name = 'Description']) &gt; 0">
                <th>Description</th>
                </xsl:if>
                <xsl:for-each select="$columns">
                <xsl:sort select="@name" order="ascending" />
                 <xsl:if test="@name != 'Description' and @name !='units/box'">
                 <th><xsl:value-of select="@name" /></th>           
                    </xsl:if>
                </xsl:for-each>
                <xsl:if test="count($columns[@name = 'units/box']) &gt; 0">
                <th>Units/Box</th>
                </xsl:if>
            </tr>
            <xsl:for-each select="$product/node [@nodeTypeAlias = 'ProductVariant']">
            <tr>
             <td><xsl:value-of select="@nodeName" /></td>
                <xsl:variable name="specs" select="wsc.library:GetXmlString(data [@alias='productSpecs'])//spec" />
                <xsl:if test="count($columns[@name = 'Description']) &gt; 0">
                 <td><xsl:value-of select="$specs[@name = 'Description']/@value" /></td>
                </xsl:if>
                <xsl:for-each select="$columns">
                <xsl:sort select="@name" order="ascending" />
                 <xsl:variable name="name" select="@name" />
                 <xsl:if test="$name != 'Description' and $name !='units/box'">
                    <td><xsl:value-of select="$specs[./@name = $name]/@value" /></td>
                    </xsl:if>
                </xsl:for-each>
                <xsl:if test="count($columns[@name = 'units/box']) &gt; 0">
                <td><xsl:value-of select="$specs[@name = 'units/box']/@value" /></td>
                </xsl:if>
            </tr>
            </xsl:for-each>
            -->
            <xsl:variable name="columns" select="umbraco.library:GetXmlDocument('/inc/product_specs.xml','False')//option" />
            <xsl:variable name="specColumns" select="wsc.library:GetXmlString($variants[position()=1]/data [@alias = 'productSpecs'])//spec" />
            <tr>
             <th>Product Number</th>
                <xsl:for-each select="$columns">
                 <xsl:variable name="column" select="@text" />
                 <xsl:if test="count($specColumns[@name = $column]) &gt; 0">
                     <th><xsl:value-of select="$column" /></th>
                    </xsl:if>
                </xsl:for-each>
            </tr>
            <xsl:for-each select="$product/node [@nodeTypeAlias = 'ProductVariant']">
            <tr>
             <td class="productIcons">
                 <xsl:value-of select="@nodeName" />
                   
                   
                    <xsl:if test="data [@alias = 'productIcons'] != ''">
          <xsl:variable name="icons" select="umbraco.library:Split(data [@alias = 'productIcons'], ',')//value" />
                        <xsl:for-each select="$icons">
                            <img src="/elements/skin/product/icons/{umbraco.library:Replace(current(), ' ', '_')}_sm.gif">
                                <xsl:attribute name="alt">
                                    <xsl:choose>
                                        <xsl:when test="current() = 'International availability'">
                                            <xsl:text>International Orders Only</xsl:text>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:value-of select="current()" />
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </xsl:attribute>
                                <xsl:attribute name="title">
                                    <xsl:choose>
                                        <xsl:when test="current() = 'International availability'">
                                            <xsl:text>International Orders Only</xsl:text>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:value-of select="current()" />
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </xsl:attribute>
                            </img>
                        </xsl:for-each>
                    </xsl:if>
                   
                </td>
                <xsl:variable name="specs" select="wsc.library:GetXmlString(data [@alias='productSpecs'])//spec" />
                <xsl:for-each select="$columns">
                 <xsl:variable name="column" select="@text" />
                 <xsl:if test="count($specs[@name = $column]) &gt; 0">
                    <td><xsl:value-of select="$specs[./@name = $column]/@value" /></td>
                    </xsl:if>
                </xsl:for-each>
            </tr>
            </xsl:for-each>
        </table>
    </div>
    </xsl:if>

    <xsl:if test="$product/data [@alias = 'productRelated'] != '' or $product/data [@alias = 'productRelatedCategory'] != ''">
    <div class="relations">
     <table>
         <tr>
             <xsl:if test="$product/data [@alias = 'productRelated'] != ''">
             <td width="50%" valign="top">
                 <h2>Related Products:</h2>
                    <xsl:for-each select="umbraco.library:Split($product/data [@alias = 'productRelated'], ',')//value">
                     <xsl:variable name="node" select="umbraco.library:GetXmlNodeById(.)" />
                        <xsl:if test="$node/@nodeTypeAlias = 'Product'">
                         <xsl:variable name="catID" select="$node/data [@alias='productCategory']//item[@alias = 'productCategory']" />
                         <xsl:variable name="category" select="umbraco.library:GetXmlNodeById($catID)" />
                            <a href="{umbraco.library:Replace(umbraco.library:NiceUrl($category/@id), '.aspx', concat('/', $node/@urlName, '.aspx'))}"><xsl:value-of select="$node/data [@alias = 'productName']" /></a><br />
                        </xsl:if>
                    </xsl:for-each>
                </td>
                </xsl:if>
             <xsl:if test="$product/data [@alias = 'productRelatedCategory'] != ''">
             <td width="50%" valign="top">
                 <h2>Related Categories:</h2>
                    <xsl:for-each select="umbraco.library:Split($product/data [@alias = 'productRelatedCategory'], ',')//value">
                     <xsl:variable name="node" select="umbraco.library:GetXmlNodeById(.)" />
                        <xsl:if test="number($node/@id)">
                     <a href="{umbraco.library:NiceUrl($node/@id)}"><xsl:value-of select="$node/@nodeName" /></a><br />
                        </xsl:if>
                    </xsl:for-each>
                </td>
                </xsl:if>
               
            </tr>
        </table>
    </div>
    </xsl:if>
    </div><!-- End #product -->

    </xsl:template>

     

    <xsl:template name="fileLink">
     <xsl:param name="name" />
        <xsl:param name="file" />
        <li>
        <a href="{$file/data [@alias ='umbracoFile']}" target="_blank">
         <xsl:value-of select="$name" />
         <xsl:if test="($name = 'Case Report' or  $name = 'White Paper') and $file/data [@alias = 'fileTitle'] != ''">
             <xsl:text>: </xsl:text>
                <xsl:value-of select="$file/data [@alias = 'fileTitle']" />
            </xsl:if>
        </a>
        </li>
    </xsl:template>


    </xsl:stylesheet>

     

  • Rich Green 2246 posts 4008 karma points
    Oct 28, 2010 @ 14:59
    Rich Green
    0

    Do you get any output when you add this near the top of your XSLT?

    Document List  - <xsl:value-of  select="$currentPage/data[@alias='documentList']"/>  - end Document list

    Rich

  • Vincent DeCapite 64 posts 83 karma points
    Oct 28, 2010 @ 15:03
    Vincent DeCapite
    0

    Nope.. I still get nothing.

  • Vincent DeCapite 64 posts 83 karma points
    Oct 28, 2010 @ 15:06
    Vincent DeCapite
    0

    When I put that last line of code in that you sent me.. I tried it in a different place.. All I get is "Document List  -  - end Document list".. it doesn't seem to be passing the numbers.. When I visualize it in the XSLT builder though. I do see the numbers.

  • Rich Green 2246 posts 4008 karma points
    Oct 28, 2010 @ 15:14
    Rich Green
    0

    Your problem I think is that your DocumentList is not in the currentPage variable.

    Unless you can get a value for DocumentList your code will not work.

    Output the currentPage variable at the top of your xslt and see what values are in there

    <textarea><xsl:copy-of select="$currentPage"/></textarea>

    Rich

     

     

  • Vincent DeCapite 64 posts 83 karma points
    Oct 28, 2010 @ 18:37
    Vincent DeCapite
    0

    When I did the last step .. This is the output I got in the textbox:

     

    <node id="2548" version="bc91763e-bf22-4f30-8491-8a837ed0adc1" parentID="2511" level="4" writerID="5" creatorID="0" nodeType="2505" template="1109" sortOrder="1" createDate="2010-06-10T08:38:58" updateDate="2010-06-23T10:35:38" nodeName="AdvanCE delivery device" urlName="advance-delivery-device" writerName="Georgia Brickman" creatorName="Administrator" nodeTypeAlias="ProductSubcategory" path="-1,1062,2506,2511,2548"></node>

  • Sean Mooney 131 posts 158 karma points c-trib
    Oct 28, 2010 @ 19:20
    Sean Mooney
    0

    Vince,

    Are you sure that the ProductSubcategory document type has a property for documentList?

  • Vincent DeCapite 64 posts 83 karma points
    Oct 28, 2010 @ 19:28
    Vincent DeCapite
    0

    The document Type which I picked as a multimedia picker was added under the product category where the others were... Under the productSubCategory nothing was added. If I visualize the XSLT just that one part, the documents show up. Its when I view the whole thing nothing shows up.. According to the output of the current page variable.. It is not getting passed.

  • Sean Mooney 131 posts 158 karma points c-trib
    Oct 28, 2010 @ 19:35
    Sean Mooney
    0

    Try this:

    <xsl:variable name="docs" select="$currentPage/data[@alias='documentList']"/>
    <xsl:if test="$docs != ''">
        <xsl:variable name="splitDocs" select="umbraco.library:Split($docs, ',')//value" />
        <ul>
        <xsl:for-each select="$splitDocs">
        <xsl:if test=". != ''">
            <xsl:variable name="mediaNode" select="umbraco.library:GetMedia(.,0)"/>
            <xsl:if test="$mediaNode != ''">
                <li>
                    <a href="{$mediaNode/data [@alias='umbracoFile']}"> test
                        <xsl:value-of select="$mediaNode/@nodeName"/>
                    </a>
                </li>
            </xsl:if>
        </xsl:if>
        </xsl:for-each>
        </ul>
    </xsl:if>
    
    
  • Vincent DeCapite 64 posts 83 karma points
    Oct 28, 2010 @ 19:49
    Vincent DeCapite
    0

    Nope.. Still nothing.

  • Sean Mooney 131 posts 158 karma points c-trib
    Oct 28, 2010 @ 19:55
    Sean Mooney
    0

    Change the line to this:

    <xsl:variable name="docs" select="$product/data[@alias='documentList']"/>

    This is becuase the product data is being set to a variable at the top of the template.

    There is no documentList property on the currentPage variable, which in this instance is the subcategory page. This is because of some url rewriting that is taking place

Please Sign in or register to post replies

Write your reply to:

Draft