The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> XML Programming
|
How to determine end of the page or beginning of a page in XSL
Discuss How to determine end of the page or beginning of a page in XSL in the XML Programming forum on Dev Shed. How to determine end of the page or beginning of a page in XSL XML Programming forum discussing XML and related technologies, including XUL and XSL. XML is a self-describing file format, designed for maximum compatibility between applications.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

October 12th, 2010, 09:52 AM
|
|
Registered User
|
|
Join Date: Oct 2010
Posts: 2
Time spent in forums: 16 m 19 sec
Reputation 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
|

October 12th, 2010, 05:18 PM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
|
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).
|

October 14th, 2010, 09:00 AM
|
|
Registered User
|
|
Join Date: Oct 2010
Posts: 2
Time spent in forums: 16 m 19 sec
Reputation 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
|

October 14th, 2010, 03:36 PM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
|
Idea: post what you have and the error message you're receiving.
|

November 6th, 2010, 06:51 AM
|
|
|
Quote: | 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(),' ',.,'
')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(position(),' ',.,'
','-------------------------','
')"/>
</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
|

November 12th, 2011, 02:58 AM
|
|
Contributing User
|
|
Join Date: Nov 2011
Posts: 42
Time spent in forums: 2 h 51 m 59 sec
Warnings Level: 10
Number of bans: 2
Reputation Power: 2
|
|
|
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.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|