Solved

XSL break table after a certain number or columns

Posted on 2006-11-02
7
296 Views
Last Modified: 2007-12-19
Hello Experts,

I am sure there is an easy way of doing this but I need to be able to break a table into a new raw after a certain number of columns.

Here is my code:

<td align="center" valign="middle">
<a href="{aspdnsf:ProductLink(ProductID, SEName, $EntityID, $EntityName)}">
<xsl:value-of select="aspdnsf:LookupImage(ProductID, 'product', 'icon', 1)" disable-output-escaping="yes"/>
</a>
<br/>
<a href="{aspdnsf:ProductLink(ProductID, SEName, $EntityID, $EntityName)}">
<xsl:value-of select="$vName" disable-output-escaping="yes"/>
</a>
</td>

Basically what I want to do is every time the column reaches a certain number (lets say 3) then the table breaks into a new raw and continues displaying the content on a new raw.

I know there is a way to do it with the XSL position() function but I can't seem to figure out how to implement that into my code.

Thank you all in advance.
0
Comment
Question by:datzent83
  • 4
  • 3
7 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 17865180
Hi datzent83,
> there is an easy way of doing this

well, this is always a bit tricky.
If the number of columns is fixed there is a little trick you can do
If you want to keep the number of columns dynamic,
you will need recursion

I will show you an example with 3 columns
For this I assume you have a list of Product elements that all have a ProductID and an SEName
I assume the $EntityID to be global, but you can have it local in the loop as well

   <xsl:template match="/">
        <xsl:for-each select="//Product[position() mod 3 = 1]">
            <tr>
                <xsl:call-template name="processCell">
                    <xsl:with-param name="thisProductID" select="ProductID"/>
                    <xsl:with-param name="thisSEName" select="SEName"/>
                </xsl:call-template>
                <xsl:call-template name="processCell">
                    <xsl:with-param name="thisProductID" select="following-sibling::Product[1]/ProductID"/>
                    <xsl:with-param name="thisSEName" select="following-sibling::Product[1]/SEName"/>
                </xsl:call-template>
                <xsl:call-template name="processCell">
                    <xsl:with-param name="thisProductID" select="following-sibling::Product[2]/ProductID"/>
                    <xsl:with-param name="thisSEName" select="following-sibling::Product[2]/SEName"/>
                </xsl:call-template>
            </tr>
        </xsl:for-each>
       
    </xsl:template>
   
    <xsl:template name="processCell">
        <xsl:param name="thisProductID"/>
        <xsl:param name="thisSEName"/>
        <td align="center" valign="middle">
            <a href="{aspdnsf:ProductLink($thisProductID, $thisSEName, $EntityID, $EntityName)}">
                <xsl:value-of select="aspdnsf:LookupImage($thisProductID, 'product', 'icon', 1)" disable-output-escaping="yes"/>
            </a>
            <br/>
            <a href="{aspdnsf:ProductLink($thisProductID, $thisSEName, $EntityID, $EntityName)}">
                <xsl:value-of select="$vName" disable-output-escaping="yes"/>
            </a>
        </td>
       
    </xsl:template>

What happens here?
<xsl:for-each select="//Product[position() mod 3 = 1]">
selects the first, the fourth, the seventh etc... of your Product elements
This is the frame to create your rows
Inside the rows I go looking for the next Product: following-sibling::Product[1]
 and the Product after the next Product: following-sibling::Product[2]

I externalise the actual cell processing to a named template that takes the specific nodes as a parameter

Cheers!
0
 

Author Comment

by:datzent83
ID: 17867358
Hello Gertone

I am having some difficulties implementing your code into my XML Package. I pasted my whole code below, can you please make the appropriate changes in that code?

<?xml version="1.0" encoding="utf-8" ?>
<package displayname="Best Sellers" version="2.1" debug="false" allowengine="true">

      <!-- ###################################################################################################### -->
      <!-- Copyright AspDotNetStorefront.com, 1995-2006.  All Rights Reserved.                                              -->
      <!-- http://www.aspdotnetstorefront.com                                                                                                    -->
      <!-- For details on this license please visit  the product homepage at the URL above.                            -->
      <!-- THE ABOVE NOTICE MUST REMAIN INTACT.                                                                   -->
      <!-- $Header: /v6.1/Web/XmlPackages/product.SimpleVariantFormat.xml.config 1     12/30/05 2:33p Administrator $              -->
      <!--                                                                                                        -->
      <!-- ###################################################################################################### -->

    <query name="Products" rowElementName="Product">
        <sql>
            <![CDATA[
                exec aspdnsf_BestSellers 180, @return, @orderby
                exec aspdnsf_GetProducts
                    @categoryID = @CatID,
                    @sectionID = @SecID,
                    @manufacturerID = @ManID,
                    @distributorID = @DistID,
                    @localeName = @locale,
                    @CustomerLevelID = @CustLevelID,
                    @affiliateID = @AffID,
                    @ProductTypeID = @ProdTypeID,
                    @ViewType = 1,
                    @pagenum = @pgnum,
                    @pagesize = 24,
                    @StatsFirst = 0,
                    @publishedonly = 1,
                    @ExcludePacks = 0,
                    @ExcludeKits = 0,
                    @ExcludeSysProds = 0,
                    @InventoryFilter = @InvFilter,
                    @sortEntityName = @entityname
            ]]>
        </sql>
        <queryparam paramname="@return" paramtype="appconfig" requestparamname="BestSellersN" sqlDataType="int" defvalue="10"  validationpattern="^\d{1,10}$" />
        <queryparam paramname="@orderby" paramtype="request" requestparamname="orderby" sqlDataType="int" defvalue="1"  validationpattern="^\d$" />
        <queryparam paramname="@CatID" paramtype="runtime" requestparamname="CatID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@SecID" paramtype="runtime" requestparamname="SecID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@ManID" paramtype="runtime" requestparamname="ManID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@DistID" paramtype="runtime" requestparamname="DistID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@locale" paramtype="runtime" requestparamname="LocaleSetting" sqlDataType="varchar" defvalue="en-US"  validationpattern="" />
        <queryparam paramname="@CustLevelID" paramtype="runtime" requestparamname="CustomerLevelID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@AffID" paramtype="runtime" requestparamname="AffiliateID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@ProdTypeID" paramtype="runtime" requestparamname="ProductTypeFilterID" sqlDataType="int" defvalue="1"  validationpattern="" />
        <queryparam paramname="@pgnum" paramtype="request" requestparamname="pagenum" sqlDataType="int" defvalue="1"  validationpattern="" />
        <queryparam paramname="@InvFilter" paramtype="appconfig" requestparamname="HideProductsWithLessThanThisInventoryLevel" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@entityname" paramtype="runtime" requestparamname="EntityName" sqlDataType="varchar" defvalue=""  validationpattern="" />
    </query>

    <PackageTransform>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
            <xsl:output method="html" omit-xml-declaration="yes" />
           
            <xsl:param name="ShowSubcatsInGrid"><xsl:value-of select="aspdnsf:AppConfig('ShowSubcatsInGrid')" /></xsl:param>
            <xsl:param name="SubcatGridCols"><xsl:value-of select="/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[EntityID=/root/Runtime/EntityID]/ColWidth" /></xsl:param>
            <xsl:param name="EntityName"><xsl:value-of select="/root/Runtime/EntityName" /></xsl:param>
            <xsl:param name="EntityID"><xsl:value-of select="/root/Runtime/EntityID" /></xsl:param>
            <xsl:param name="WholesaleOnlySite"><xsl:value-of select="aspdnsf:AppConfigBool('WholesaleOnlySite')"/></xsl:param>

            <xsl:param name="LocaleSetting" select="/root/Runtime/LocaleSetting" />
            <xsl:param name="WebConfigLocaleSetting" select="/root/Runtime/WebConfigLocaleSetting" />

            <xsl:param name="BestSellersShowSales"><xsl:value-of select="aspdnsf:AppConfigBool('BestSellersShowSales')" disable-output-escaping="yes" /></xsl:param>
            <xsl:param name="ShowPics"><xsl:value-of select="aspdnsf:AppConfigBool('BestSellersShowPics')"/></xsl:param>
            <xsl:param name="colspan"><xsl:choose><xsl:when test="BestSellersShowSales='true'">5</xsl:when><xsl:otherwise>4</xsl:otherwise></xsl:choose></xsl:param>
            <xsl:param name="ProductCount" select="count(/root/Products/Product)" />


            <xsl:template match="/">
                <xsl:choose>
                    <xsl:when test="$ProductCount &gt; 0">
                        <table width="100%" cellpadding="2" cellspacing="0" border="0">
                            <xsl:attribute name="style">border-style: solid; border-width: 0px; border-color: #<xsl:value-of select="aspdnsf:AppConfig('HeaderBGColor')" /></xsl:attribute>
                            <tr>
                                <td align="left" valign="top">
                                    <table width="100%" cellpadding="4" cellspacing="0" border="0">
                                        <xsl:attribute name="style"><xsl:value-of select="aspdnsf:AppConfig('BoxFrameStyle')" /></xsl:attribute>
                                        <tr>
                                            <td align="left" valign="top">
                                                <table border="0" cellpadding="0" cellspacing="1" width="100%">
                                                    <tr>
                                                        <xsl:if test="BestSellersShowSales='true'">
                                                            <td align="center"><b><a href="bestsellers.aspx?orderby=units"><xsl:value-of select="aspdnsf:GetString('bestsellers.aspx.1')" disable-output-escaping="yes" /></a></b></td>
                                                            <td align="center"><b><a href="bestsellers.aspx?orderby=amount"><xsl:value-of select="aspdnsf:GetString('bestsellers.aspx.2')" disable-output-escaping="yes" /></a></b></td>
                                                        </xsl:if>
                                                    </tr>
                                                    <tr><td colspan="{$colspan}" height="4" width="100%"><img src="images/spacer.gif" height="1" width="1" /></td></tr>
                                                    <xsl:apply-templates select="/root/Products/Product"></xsl:apply-templates>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr><td colspan="{$colspan}">&#0160;</td></tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </xsl:when>
                    <xsl:otherwise>
                        <p align="left"><b><xsl:value-of select="aspdnsf:GetString('bestsellers.aspx.3')" disable-output-escaping="yes" /></b></p>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:template>
           
            <xsl:template match="Product">
                <xsl:param name="pName">
                    <xsl:choose>
                        <xsl:when test="count(ProductName/ml/locale[@name=$LocaleSetting])!=0">
                            <xsl:value-of select="ProductName/ml/locale[@name=$LocaleSetting]"/>
                        </xsl:when>
                        <xsl:when test="count(ProductName/ml/locale[@name=$WebConfigLocaleSetting]) !=0 ">
                            <xsl:value-of select="ProductName/ml/locale[@name=$WebConfigLocaleSetting]"/>
                        </xsl:when>
                        <xsl:when test="count(ProductName/ml)=0">
                            <xsl:value-of select="ProductName"/>
                        </xsl:when>
                    </xsl:choose>
                </xsl:param>

                <xsl:param name="vName">
                    <xsl:choose>
                        <xsl:when test="count(VariantName/ml/locale[@name=$LocaleSetting])!=0">
                            <xsl:value-of select="VariantName/ml/locale[@name=$LocaleSetting]"/>
                        </xsl:when>
                        <xsl:when test="count(VariantName/ml/locale[@name=$WebConfigLocaleSetting]) !=0 ">
                            <xsl:value-of select="VariantName/ml/locale[@name=$WebConfigLocaleSetting]"/>
                        </xsl:when>
                        <xsl:when test="count(VariantName/ml)=0">
                            <xsl:value-of select="VariantName"/>
                        </xsl:when>
                    </xsl:choose>
                </xsl:param>

                <xsl:param name="ProductName"><xsl:value-of select="$pName" /><xsl:if test="$vName!=''"><xsl:value-of select="concat('-', $vName)" /></xsl:if></xsl:param>
                <xsl:param name="ProductSKU"><xsl:value-of select="SKU" /><xsl:if test="SKUSuffix!=''"><xsl:value-of select="SKUSuffix" /></xsl:if></xsl:param>
                   
                    <td align="center" valign="middle">
                        <a href="{aspdnsf:ProductLink(ProductID, SEName, $EntityID, $EntityName)}">
                        <xsl:value-of select="aspdnsf:LookupImage(ProductID, 'product', 'icon', 1)" disable-output-escaping="yes"/>
                    </a>
                    <br/>
                        <a href="{aspdnsf:ProductLink(ProductID, SEName, $EntityID, $EntityName)}">
                        <xsl:value-of select="$vName" disable-output-escaping="yes"/>
                    </a>
                    </td>
            </xsl:template>

        </xsl:stylesheet>
    </PackageTransform>
</package>


Thank you in advance!
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 17876431
datzent83,
> <xsl:apply-templates select="/root/Products/Product"></xsl:apply-templates>

put the  <xsl:for-each select="//Product[position() mod 3 = 1]">
loop where currently the apply-templates is

put the <xsl:template name="processCell">
somewhere in your stylesheet and it should work

cheers

Geert
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:datzent83
ID: 17877024
Hello Geert,

I have applied the code the way you instructed, but I am getting an error which I have never seen before.

This is the error that I am getting:
Exception=Last Trace Point=[]. An error occurred during a call to extension function 'ProductLink'. See InnerException for a complete description of the error.

Below is the code with your instructions. Please take a look at it and let me know what the problem is:

<?xml version="1.0" encoding="utf-8" ?>
<package displayname="Best Sellers" version="2.1" debug="false" allowengine="true">

    <query name="Products" rowElementName="Product">
        <sql>
            <![CDATA[
                exec aspdnsf_BestSellers 180, @return, @orderby
                exec aspdnsf_GetProducts
                    @categoryID = @CatID,
                    @sectionID = @SecID,
                    @manufacturerID = @ManID,
                    @distributorID = @DistID,
                    @localeName = @locale,
                    @CustomerLevelID = @CustLevelID,
                    @affiliateID = @AffID,
                    @ProductTypeID = @ProdTypeID,
                    @ViewType = 1,
                    @pagenum = @pgnum,
                    @pagesize = 24,
                    @StatsFirst = 0,
                    @publishedonly = 1,
                    @ExcludePacks = 0,
                    @ExcludeKits = 0,
                    @ExcludeSysProds = 0,
                    @InventoryFilter = @InvFilter,
                    @sortEntityName = @entityname
            ]]>
        </sql>
        <queryparam paramname="@return" paramtype="appconfig" requestparamname="BestSellersN" sqlDataType="int" defvalue="10"  validationpattern="^\d{1,10}$" />
        <queryparam paramname="@orderby" paramtype="request" requestparamname="orderby" sqlDataType="int" defvalue="1"  validationpattern="^\d$" />
        <queryparam paramname="@CatID" paramtype="runtime" requestparamname="CatID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@SecID" paramtype="runtime" requestparamname="SecID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@ManID" paramtype="runtime" requestparamname="ManID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@DistID" paramtype="runtime" requestparamname="DistID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@locale" paramtype="runtime" requestparamname="LocaleSetting" sqlDataType="varchar" defvalue="en-US"  validationpattern="" />
        <queryparam paramname="@CustLevelID" paramtype="runtime" requestparamname="CustomerLevelID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@AffID" paramtype="runtime" requestparamname="AffiliateID" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@ProdTypeID" paramtype="runtime" requestparamname="ProductTypeFilterID" sqlDataType="int" defvalue="1"  validationpattern="" />
        <queryparam paramname="@pgnum" paramtype="request" requestparamname="pagenum" sqlDataType="int" defvalue="1"  validationpattern="" />
        <queryparam paramname="@InvFilter" paramtype="appconfig" requestparamname="HideProductsWithLessThanThisInventoryLevel" sqlDataType="int" defvalue="0"  validationpattern="" />
        <queryparam paramname="@entityname" paramtype="runtime" requestparamname="EntityName" sqlDataType="varchar" defvalue=""  validationpattern="" />
    </query>

    <PackageTransform>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
            <xsl:output method="html" omit-xml-declaration="yes" />
           
            <xsl:param name="ShowSubcatsInGrid"><xsl:value-of select="aspdnsf:AppConfig('ShowSubcatsInGrid')" /></xsl:param>
            <xsl:param name="SubcatGridCols"><xsl:value-of select="/root/EntityHelpers/*[name()=/root/Runtime/EntityName]/descendant::Entity[EntityID=/root/Runtime/EntityID]/ColWidth" /></xsl:param>
            <xsl:param name="EntityName"><xsl:value-of select="/root/Runtime/EntityName" /></xsl:param>
            <xsl:param name="EntityID"><xsl:value-of select="/root/Runtime/EntityID" /></xsl:param>
            <xsl:param name="WholesaleOnlySite"><xsl:value-of select="aspdnsf:AppConfigBool('WholesaleOnlySite')"/></xsl:param>

            <xsl:param name="LocaleSetting" select="/root/Runtime/LocaleSetting" />
            <xsl:param name="WebConfigLocaleSetting" select="/root/Runtime/WebConfigLocaleSetting" />

            <xsl:param name="BestSellersShowSales"><xsl:value-of select="aspdnsf:AppConfigBool('BestSellersShowSales')" disable-output-escaping="yes" /></xsl:param>
            <xsl:param name="ShowPics"><xsl:value-of select="aspdnsf:AppConfigBool('BestSellersShowPics')"/></xsl:param>
            <xsl:param name="colspan"><xsl:choose><xsl:when test="BestSellersShowSales='true'">5</xsl:when><xsl:otherwise>4</xsl:otherwise></xsl:choose></xsl:param>
            <xsl:param name="ProductCount" select="count(/root/Products/Product)" />

            <xsl:template match="/">
                <xsl:choose>
                    <xsl:when test="$ProductCount &gt; 0">
                        <table width="100%" cellpadding="2" cellspacing="0" border="0">
                            <xsl:attribute name="style">border-style: solid; border-width: 0px; border-color: #<xsl:value-of select="aspdnsf:AppConfig('HeaderBGColor')" /></xsl:attribute>
                            <tr>
                                <td align="left" valign="top">
                                    <table width="100%" cellpadding="4" cellspacing="0" border="0">
                                        <xsl:attribute name="style"><xsl:value-of select="aspdnsf:AppConfig('BoxFrameStyle')" /></xsl:attribute>
                                        <tr>
                                            <td align="left" valign="top">
                                                <table border="0" cellpadding="0" cellspacing="1" width="100%">
                                                    <tr>
                                                        <xsl:if test="BestSellersShowSales='true'">
                                                            <td align="center"><b><a href="bestsellers.aspx?orderby=units"><xsl:value-of select="aspdnsf:GetString('bestsellers.aspx.1')" disable-output-escaping="yes" /></a></b></td>
                                                            <td align="center"><b><a href="bestsellers.aspx?orderby=amount"><xsl:value-of select="aspdnsf:GetString('bestsellers.aspx.2')" disable-output-escaping="yes" /></a></b></td>
                                                        </xsl:if>
                                                    </tr>
                                                    <tr><td colspan="{$colspan}" height="4" width="100%"><img src="images/spacer.gif" height="1" width="1" /></td></tr>
                                                    <xsl:apply-templates select="/root/Products/Product"></xsl:apply-templates>
                                                    <xsl:for-each select="//Product[position() mod 3 = 1]">
                                    <tr>
                                  <xsl:call-template name="processCell">
                                            <xsl:with-param name="thisProductID" select="ProductID"/>
                                            <xsl:with-param name="thisSEName" select="SEName"/>
                                  </xsl:call-template>
                                  <xsl:call-template name="processCell">
                                            <xsl:with-param name="thisProductID" select="following-sibling::Product[1]/ProductID"/>
                                            <xsl:with-param name="thisSEName" select="following-sibling::Product[1]/SEName"/>
                                  </xsl:call-template>
                                  <xsl:call-template name="processCell">
                                            <xsl:with-param name="thisProductID" select="following-sibling::Product[2]/ProductID"/>
                                            <xsl:with-param name="thisSEName" select="following-sibling::Product[2]/SEName"/>
                                  </xsl:call-template>
                                    </tr>
                          </xsl:for-each>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr><td colspan="{$colspan}">&#0160;</td></tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </xsl:when>
                    <xsl:otherwise>
                        <p align="left"><b><xsl:value-of select="aspdnsf:GetString('bestsellers.aspx.3')" disable-output-escaping="yes" /></b></p>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:template>

            <xsl:template name="processCell">
            <xsl:param name="pName">
                    <xsl:choose>
                        <xsl:when test="count(ProductName/ml/locale[@name=$LocaleSetting])!=0">
                            <xsl:value-of select="ProductName/ml/locale[@name=$LocaleSetting]"/>
                        </xsl:when>
                        <xsl:when test="count(ProductName/ml/locale[@name=$WebConfigLocaleSetting]) !=0 ">
                            <xsl:value-of select="ProductName/ml/locale[@name=$WebConfigLocaleSetting]"/>
                        </xsl:when>
                        <xsl:when test="count(ProductName/ml)=0">
                            <xsl:value-of select="ProductName"/>
                        </xsl:when>
                    </xsl:choose>
                </xsl:param>

                <xsl:param name="vName">
                    <xsl:choose>
                        <xsl:when test="count(VariantName/ml/locale[@name=$LocaleSetting])!=0">
                            <xsl:value-of select="VariantName/ml/locale[@name=$LocaleSetting]"/>
                        </xsl:when>
                        <xsl:when test="count(VariantName/ml/locale[@name=$WebConfigLocaleSetting]) !=0 ">
                            <xsl:value-of select="VariantName/ml/locale[@name=$WebConfigLocaleSetting]"/>
                        </xsl:when>
                        <xsl:when test="count(VariantName/ml)=0">
                            <xsl:value-of select="VariantName"/>
                        </xsl:when>
                    </xsl:choose>
                </xsl:param>
                <xsl:param name="ProductName"><xsl:value-of select="$pName" /><xsl:if test="$vName!=''"><xsl:value-of select="concat('-', $vName)" /></xsl:if></xsl:param>
                <xsl:param name="ProductSKU"><xsl:value-of select="SKU" /><xsl:if test="SKUSuffix!=''"><xsl:value-of select="SKUSuffix" /></xsl:if></xsl:param>
                    <xsl:param name="thisProductID"/>
                    <xsl:param name="thisSEName"/>
                    <td align="center" valign="middle">
                        <a href="{aspdnsf:ProductLink($thisProductID, $thisSEName, $EntityID, $EntityName)}">
                            <xsl:value-of select="aspdnsf:LookupImage($thisProductID, 'product', 'icon', 1)" disable-output-escaping="yes"/>
                             </a>
                        <br/>
                        <a href="{aspdnsf:ProductLink($thisProductID, $thisSEName, $EntityID, $EntityName)}">
                            <xsl:value-of select="$vName" disable-output-escaping="yes"/>
                        </a>
                    </td>
                </xsl:template>
        </xsl:stylesheet>
    </PackageTransform>
</package>

Please help me figure out why that is happening! Thank you!
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 17877175
I don't see a definition for this external function
aspdnsf:ProductLink
There is no definition for the other external functions either,
Productlink just happended to be the first one around

you need to implement the functions
something like
      <msxsl:script language="JScript" implements-prefix="aspdnsf">
      <![CDATA[
            function ProductLink()
            {
                                ....
            }
      ]]>
      </msxsl:script>

or something similar if you are not using msxml

0
 

Author Comment

by:datzent83
ID: 17878471
Hello Geert,

With your help I have figured out how I can implement the loop into my code. Please take a look at what I have done at the code below. It is not exactly what you have suggested, but it worked. I will however accept your answer as correct! :-)

<xsl:template match="Product">
      <xsl:if test="position()  mod 4 = 1">
            <tr>
                  <xsl:for-each select=". | following-sibling::*[position() &lt; 4]">
                        <xsl:call-template name="ProductCell"></xsl:call-template>
                  </xsl:for-each>
           </tr>
      </xsl:if>
</xsl:template>

Thank you for your help!!!
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 17879702
wellcome,

what you have done is a smart way of avoiding to copy/paste all the template calls, looks nice

cheers

Geert
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now