#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0

    How to determine end of the page or beginning of a page in XSL


    Hi,
    I have a requirement to display a horizontal line between the text as shown below in a table using XSL

    aababfffsdfdf
    ffssgdgfdgfgfd
    ________________________
    fsgfsdfgjgfdjgdf
    gdghjkjghjggdfg
    _________________________
    ertggegegeg
    ................

    But the horizontal line shouldn't display if it is the last row of the page or first row of the page. How do we achieve this in XSL. I have been struggling to find the solution, but I couldn't.I appreciate your help in advance.

    Thanks a lot,
    xsl_usr
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,007
    Rep Power
    9398
    I assume you have a loop somewhere? At the beginning of it, before showing each row, check if position()>1: if so, include a divider (be it dashes or an <hr> or whatever).
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2010
    Posts
    2
    Rep Power
    0
    I tried, but it is giving me error when I use it at the beginning of the loop. Please suggest any ideas.

    Thanks,
    xsl_usr
  6. #4
  7. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,007
    Rep Power
    9398
    Idea: post what you have and the error message you're receiving.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    191
    Rep Power
    49

    Cool


    Originally Posted by aion4217
    every week or every other week is much safer.


    help is possible but without code than is a ritle

    xml code for test
    Code:
    <?xml version="1.0"?>
    <data>
    	<item>value1</item>
    	<item>value2</item>
    	<item>value3</item>
    	<item>value4</item>
    </data>
    Code:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    	<xsl:output method="text"/>
    	<xsl:template match="/">
    		<xsl:apply-templates select="data"/>
    	</xsl:template>
    	<xsl:template match="data">
    		<xsl:apply-templates select="item"/>
    	</xsl:template>
    	<xsl:template match="item">
    		<xsl:choose>
    			<xsl:when test="position()=last()">
    				<xsl:value-of select="concat(position(),'  ',.,'&#xA;')"/>
    			</xsl:when>
    			<xsl:otherwise>
    				<xsl:value-of select="concat(position(),'  ',.,'&#xA;','-------------------------','&#xA;')"/>
    			</xsl:otherwise>
    		</xsl:choose>
    	</xsl:template>
    </xsl:stylesheet>
    Result
    Code:
    1  value1
    -------------------------
    2  value2
    -------------------------
    3  value3
    -------------------------
    4  value4
    Helmut Hagemann Germany

    fallen to the bottom of the facts?
    I reach my hand and we go together


    wer lesen und google kann ist klar im Vorteil
    who read and google is able is clear in the advantage
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    42
    Rep Power
    3
    This followup toJeni Tennison's Beginning XSLThas been updated to accomodate the revised XSLT standard. Part one of this book introduces XML and XSLT at a comfortable pace, and gradually demonstrates techniques for generating HTML (plus other formats), from XML. In part two, Tennison applies theory to real-life XSLT capabilities-including generating graphics.

IMN logo majestic logo spyfu logo threadwatch logo seochat tools logo