Copied to clipboard

Flag this post as spam?

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


  • Sajid Riaz 142 posts 165 karma points
    Jul 16, 2010 @ 19:53
    Sajid Riaz
    0

    convert ver-4 xslt to ver4.5 using xsltconverter package

    <?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:variable name="ID" select="$currentPage/frontPageImages"/>
    <xsl:template match="/">

    <!-- start writing XSLT -->
    <xsl:if test="$ID &gt; 0">
    <xsl:variable name="mediaItems" select="umbraco.library:GetMedia($ID, true())"/>
    <xsl:for-each select="$mediaItems/node">      
    <img>
        <xsl:attribute name="src">
        <xsl:text>/umbraco/imagegen.ashx?image=</xsl:text>
        <xsl:value-of select="current()/umbracoFile"/>
        <xsl:text>&amp;width=300</xsl:text>
        </xsl:attribute>
    </img>
    </xsl:for-each>
    </xsl:if>

    </xsl:template>

    </xsl:stylesheet>

     

    is the above 4.5 conversion correct.  as it still does not work.

  • Simon Kibsgård 62 posts 73 karma points
    Jul 16, 2010 @ 23:56
    Simon Kibsgård
    1

    Hi Sajid

    It seems to me that you should change <xsl:for-each select="$mediaItems/node">  to <xsl:for-each select="$mediaItems/Image">   

    Regards, Simon K

  • Sajid Riaz 142 posts 165 karma points
    Jul 17, 2010 @ 00:01
    Sajid Riaz
    0

    Hey Simon, thanx 4 yr reply.  i did the conversion using the xslt converter package.

    what u say is correct i changed it to this and it works:

     

    ?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:variable name="imageRoot" select="$currentPage/gallery"/>
    <xsl:template match="/">

    <!-- start writing XSLT -->
     <xsl:variable name="mediaItems" select="umbraco.library:GetMedia($imageRoot, true())"/>
      <xsl:copy-of select="$mediaItems/Image"/>
      <xsl:for-each select="$mediaItems/Folder/Image">
        
        
      <xsl:variable name="picFile" select="umbracoFile"/>
        <xsl:variable name="picW" select="umbracoWidth"/>
        <xsl:variable name="picH" select="umbracoHeight"/>
          <img>
              <xsl:attribute name="src"><xsl:value-of select="$picFile"/></xsl:attribute>  
          </img>
    </xsl:for-each>
    </xsl:template>

    </xsl:stylesheet>

  • Markus Klug 5 posts 101 karma points
    Jul 21, 2010 @ 09:36
    Markus Klug
    0

    Hi Sajid, you pointed out a real problem there. As I just wrote in another post:

    "The problem with your suggestion is that replacing "$parent/node" with "$parent/*[@isDoc]" will cause problems if the <node> in question was a media-node. And as far as I can see right now, there is no easy way to determine this. One solution to work around this to give the user the option to run the converter in two different "modes", like "Documents" mode and "Media" mode.
    I'll give this some thought and update the package in the next couple of days..."

    Now, the problem is that my converter already replaces every occurence of  "::node" with "*[@isDoc]". And as I wrote above, that's bad if it was a media-node.

    Gotta fix that as soon as I can...

     

     

  • Sajid Riaz 142 posts 165 karma points
    Jul 21, 2010 @ 09:44
    Sajid Riaz
    0

    thanx for the reply Marcus

Please Sign in or register to post replies

Write your reply to:

Draft