Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 26th, 2014, 07:15 AM
Registered User
 
Join Date: Mar 2014
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Default Image Gallery issue

-I generating image gallery that suports different types of containers. ie 33% container,50%container and 100 % container.
-if container is of type 33% percent then three containers will come in one row separated by verticle line and margin. I want to remove left margin of first container and right margin last container.
-if container is of type 50% percent then two containers will come in one row separated by verticle line and margin. I want to remove left margin of first container and right margin other container.
-if container is of type 100% percent then only one container is there and no need to remove margin.

-Issue is that when multiple containers of this types are present in image gallery in any sequence then how predict which containers rignt margin and line separator has to remove. how to do this?

xsl file is following:

<xsl:when test="intLayoutType = 219">
<WD:ContentController MenuPosition="Content" ResourceFamily="CNT" runat="server">
<xsl:attribute name="contentId">
<xsl:value-of select="autContentId"/>
</xsl:attribute>
<ContentTemplate>
<xsl:if test="intNum4 = 2">
<![CDATA[<div class="three_column"]]>
<xsl:if test="position() = 1">
<![CDATA[style="margin-left: 0px;"]]>
</xsl:if>
<xsl:if test="position() = last() and intNum4 = 2">
<![CDATA[style="margin-right: 0px; border-right:none;"]]>
</xsl:if>
<xsl:if test="position() mod 3 = 0 and intNum4 = 2 and position() != 1">
<![CDATA[style="margin-right: 0px; border-right:none;clear : right"]]>
</xsl:if>
<![CDATA[>]]>
</xsl:if>

<xsl:if test="intNum4 = 1">
<![CDATA[<div class="two_column"]]>
<xsl:if test="position() = 1">
<![CDATA[style="margin-left: 0px;"]]>
</xsl:if>
<xsl:if test="position() = last() and intNum4 = 1">
<![CDATA[style="margin-right: 0px; border-right:none;"]]>
</xsl:if>
<xsl:if test="position() mod 2 = 0 and intNum4 = 1">
<![CDATA[style="margin-right: 0px; border-right:none;"]]>
</xsl:if>
<![CDATA[>]]>
</xsl:if>

<xsl:if test="intNum4 = 0">
<![CDATA[<div class="one_column">]]>
</xsl:if>
<!--for 33% container and 50% container-->
<xsl:if test="intNum4 = 2 or intNum4 = 1">
<![CDATA[<div class="gallery_margin_right"]]>
<!--<xsl:if test="position() = last()">
<![CDATA[style="margin-right: 0px;"]]>
</xsl:if>-->
<![CDATA[>]]>
<xsl:if test="string-length(vchTitle) &gt; 0">
<![CDATA[<h1 class="gallery_title">]]>
<xsl:value-of select="vchTitle" />
<![CDATA[</h1>]]>
</xsl:if>

<!--Website display-->

<xsl:if test="string-length(vchImageUrl1) &gt; 0">
<![CDATA[<asp:Image runat="server" class="gallery_img" ImageUrl="]]><xsl:value-of select="vchImageUrl1" />
<![CDATA[" ToolTip="]]><xsl:value-of select="vchImageAltText1" />
<![CDATA[" AlternateText="]]><xsl:value-of select="vchImageAltText1" />
<![CDATA[" />]]>
</xsl:if>
<!--<div>
<xsl:value-of select="vchTxt1" />
</div>-->
<![CDATA[<div class="gallery_description">]]><xsl:value-of select="vchTxt1" />
<![CDATA[</div>]]>

<xsl:if test="string-length(vchTxt4) &gt; 0">
<![CDATA[<p class="gallery_plink">]]>
<![CDATA[<asp:HyperLink runat="server" class="gallery_link" Text="]]><xsl:value-of select="vchTxt4" />
<![CDATA[" NavigateUrl="]]><xsl:value-of select="vchTxt6" />
<![CDATA[" ToolTip="]]><xsl:value-of select="vchTxt5" />
<![CDATA[" Target="]]><xsl:value-of select="vchTxt9" />
<![CDATA[" />]]>
<![CDATA[</p>]]>
</xsl:if>

<xsl:if test="string-length(vchAscxTagName) &gt; 0">
<![CDATA[<wd:]]><xsl:value-of select="vchAscxTagName" /><![CDATA[ id="imageStrip" class="gallery_imageStrip" runat="server" ContentId="]]><xsl:value-of select="autContentId" /><![CDATA[" />]]>
</xsl:if>

<![CDATA[</div>]]>
</xsl:if>
<!--for 100 % container-->
<xsl:if test="intNum4 = 0">


<!--Website display-->
<![CDATA[<div style="clear: both;">]]>
<![CDATA[</div>]]>
<![CDATA[<div>]]>
<xsl:if test="string-length(vchImageUrl1) &gt; 0">
<![CDATA[<div class="gallery_imgalign_one_column">]]>
<![CDATA[<asp:Image runat="server" class="gallery_img" ImageUrl="]]><xsl:value-of select="vchImageUrl1" />
<![CDATA[" ToolTip="]]><xsl:value-of select="vchImageAltText1" />
<![CDATA[" AlternateText="]]><xsl:value-of select="vchImageAltText1" />
<![CDATA[" />]]>
<![CDATA[</div>]]>
</xsl:if>

<![CDATA[<div class="gallery_one_column">]]>
<xsl:if test="string-length(vchTitle) &gt; 0">
<![CDATA[<h1 class="gallery_title_one_column">]]>
<xsl:value-of select="vchTitle" />
<![CDATA[</h1>]]>
</xsl:if>

<![CDATA[<div class="gallery_description_one_column">]]><xsl:value-of select="vchTxt1" />
<![CDATA[</div>]]>

<xsl:if test="string-length(vchTxt4) &gt; 0">
<![CDATA[<p class="gallery_plink_one_column">]]>
<![CDATA[<asp:HyperLink runat="server" class="gallery_link" Text="]]><xsl:value-of select="vchTxt4" />
<![CDATA[" NavigateUrl="]]><xsl:value-of select="vchTxt6" />
<![CDATA[" ToolTip="]]><xsl:value-of select="vchTxt5" />
<![CDATA[" Target="]]><xsl:value-of select="vchTxt9" />
<![CDATA[" />]]>
<![CDATA[</p>]]>
</xsl:if>

<xsl:if test="string-length(vchAscxTagName) &gt; 0">
<![CDATA[<wd:]]><xsl:value-of select="vchAscxTagName" /><![CDATA[ id="imageStrip" class="gallery_imageStrip" runat="server" ContentId="]]><xsl:value-of select="autContentId" /><![CDATA[" />]]>
</xsl:if>
<![CDATA[</div>]]>
<![CDATA[</div>]]>

</xsl:if>
<xsl:if test="intNum4 = 0 or intNum4 = 1 or intNum4 = 2">
<![CDATA[<div style="clear: both;">]]>
<![CDATA[</div>]]>
<![CDATA[</div>]]>
</xsl:if>
</ContentTemplate>
</WD:ContentController>
</xsl:when>


I want to apply "style="margin-right: 0px; border-right:none;clear : right" to every last element in each row where intNum4 = 2.

Last edited by Vikas khartude; March 26th, 2014 at 08:07 AM..
 
Old March 26th, 2014, 07:46 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

What has this got to do with XSLT?

If you need help getting an XSLT transformation to work, then you need to show ius the XML input, the desired XML/HTML output, and your XSLT code.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
Vikas khartude (March 26th, 2014)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Image Gallery Gudni BOOK: Beginning ASP.NET Web Pages with WebMatrix 2 August 2nd, 2012 04:09 AM
Building an image gallery chefs_corner BOOK: Beginning ASP.NET Web Pages with WebMatrix 1 August 2nd, 2012 02:30 AM
Image Gallery digink BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 May 4th, 2010 08:48 AM
Trying to Create Image Gallery jazzcatone ASP.NET 2.0 Basics 0 September 23rd, 2007 04:06 AM
Image Gallery Help morpheus Javascript How-To 3 February 20th, 2006 07:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.