Copied to clipboard

Flag this post as spam?

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


  • Simon McM 1 post 21 karma points
    May 24, 2011 @ 13:14
    Simon McM
    0

    Converting to new XSLT schema

    Hi,

    I am creating a site in the Umbraco 4.7  and I am having trouble conveting the following XSLT from the old schema to the new schema:

    <?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"
     exclude-result-prefixes="msxml umbraco.library">
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:variable name="gallery" select="/macro/gallery"/>
    <xsl:variable name="galleryName" select="/macro/galleryName"/>
    <!-- need some if here so that we dont have nulls -->
    <xsl:variable name="height" select="/macro/height"/>
    <xsl:variable name="width" select="/macro/width"/>
    <xsl:variable name="align" select="/macro/align"/>
    <xsl:variable name="newWindow">
      <xsl:choose>
     <xsl:when test="/macro/align='right'">float:right</xsl:when>
     <xsl:otherwise>margin: 0px auto 10px auto;</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:template match="/">
    <!-- start writing XSLT -->
    <xsl:if test="$gallery/node/@id">
    <xsl:variable name="media" select="umbraco.library:GetMedia($gallery/node/@id, 'true')"/>
    <xsl:call-template name="drawNodeInline">

      <xsl:with-param name="nodes" select="$media/node"/>
     </xsl:call-template>

    <script type="text/javascript" language="javascript">
    function showPic (whichpic, desc, placeholder) {
     if (document.getElementById) {
      document.getElementById(placeholder).src = whichpic.href;
      //if (whichpic.title) {
       document.getElementById(desc).childNodes[0].nodeValue = whichpic.title;
     // } else {
      // document.getElementById(desc).childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
     // }
      return false;
     } else {
      return true;
     }
    }
    </script>

    </xsl:if>
    </xsl:template>
    <xsl:template name="drawNodeInline">
    <xsl:param name="nodes"/>

    <div class="gallery" style="width:{$width}px;{$newWindow}">

    <xsl:for-each select="$nodes">

    <xsl:if test="position()=1">
    <!--<xsl:value-of select="./data [@alias='umbracoWidth']" />-->
    <img id="placeholder{$galleryName}" src="{./data[@alias = 'umbracoFile']}" title="Image gallery" alt="Image gallery" />
    <p id="desc{$galleryName}"></p>
    </xsl:if>
    <!--<xsl:if test="position()=1"><p>Previous - </p></xsl:if>-->
    <xsl:if test="position() &lt; 25">
    <a onclick="return showPic(this, 'desc{$galleryName}', 'placeholder{$galleryName}')" onkeypress="return showPic(this, 'desc{$galleryName}', 'placeholder{$galleryName}')" href="{./data[@alias = 'umbracoFile']}" title="{@nodeName}" target="_blank"><xsl:value-of select="position()" /></a>
    </xsl:if>
    </xsl:for-each>
    <br />
    <xsl:for-each select="$nodes">
    <xsl:if test="position() &gt;= 25">
    <a onclick="return showPic(this, 'desc{$galleryName}', 'placeholder{$galleryName}')" onkeypress="return showPic(this, 'desc{$galleryName}', 'placeholder{$galleryName}')" href="{./data[@alias = 'umbracoFile']}" title="{@nodeName}" target="_blank"><xsl:value-of select="position()" /></a>
    </xsl:if>
    <!--<xsl:if test="position()=last()"><p><xsl:value-of select="position()" /> images in gallery</p></xsl:if>-->
    <!--<xsl:if test="not(position()=last())"> - </xsl:if>-->
    <!--<xsl:if test="position()=last()"><a onclick="return showPic(this.previousSibling, 'desc{$galleryName}', 'placeholder{$galleryName}')" href="{./data[@alias = 'umbracoFile']}" title="{@nodeName}">Next</a>
    </xsl:if>-->
    </xsl:for-each>
    </div>
    </xsl:template>
    </xsl:stylesheet>

    I have tried the following online and package converters and neither seem to work:

    http://blackpoint.dk/umbraco-workbench/tools/convert-xml-schema-to-45-.aspx?p=2

    http://our.umbraco.org/projects/developer-tools/xsltupdater-for-umbraco

     

    Any help would be greatly apreciated??

     

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies