Copied to clipboard

Flag this post as spam?

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


  • Martin 278 posts 662 karma points
    Jan 26, 2012 @ 10:47
    Martin
    0

    Help with DAMP XPath

    Hi, 
    Im needing a little help with my Xpath for the DAMP.
    Ive installed 2.0 with the samples and i am trying to use it load PDF's.

    My problem is with my XPath. Ive copied it exactly like in the sample.

    <!--DAMP File-->
        <xsl:variable name="file" select="$currentPage/dampFile/DAMP/mediaItem/File" />
        <h3 style="margin-top: 20px;">XSLT DAMP file sample</h3>
        <p>Download: <href="{$file/umbracoFile}" target="_blank"><xsl:value-of select="$file/@nodeName"/></a></p>

    When I call the vallue of he content alias "dampFile",I get back

    " /media/23764/wisefish-product_information_sheet.pdfpdf459740"

    Ive also had a look in the xml, which is showing the following

       <dampFile>
                <DAMP fullMedia="">
                  <mediaItem>
                    <File id="1348" version="c2f43d86-da0f-4df1-b7b0-dbed30092db2" parentID="1347" level="4" writerID="0" nodeType="1033" template="0" sortOrder="1" createDate="2012-01-25T12:08:54" updateDate="2012-01-25T12:08:50" nodeName="Product Information" urlName="productinformation" writerName="Martin" nodeTypeAlias="File" path="-1,1116,1345,1347,1348">
                      <umbracoFile>/media/23764/wisefish-product_information_sheet.pdf</umbracoFile>
                      <umbracoExtension>pdf</umbracoExtension>
                      <umbracoBytes>459740</umbracoBytes>
                    </File>
                  </mediaItem>
                </DAMP>
              </dampFile>

     

    Could someone help me out and explain the variable select path?

    Thanks

    Martin

     


     

     

     

     

     

     

     

     

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 26, 2012 @ 10:51
    Jeroen Breuer
    1

    Hmm seems everything is ok. If you call the dampfile the value you get back is correct because it returns everything that is in that element. You should call dampfile/DAMP/mediaItem/File/umbracoFile to get the pdf path. Do you understand?

    Jeroen

  • Martin 278 posts 662 karma points
    Jan 26, 2012 @ 11:08
    Martin
    0

    Thanks Jeroen, 

    I removed the "$currentPage" from the value path of the variable and it seems to work.

Please Sign in or register to post replies

Write your reply to:

Draft