SunQuest
           XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 4th, 2003, 09:18 PM
esosa esosa is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Mexicali Mexico
Posts: 23 esosa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to esosa
XSL Pagination using MSXML DOM

I need to implement pagination on the results of a XSLT transformation, because the result sometimes is way too big for the browser to display.

I am using the following xslt (server Side), in wich I implemented a snippet of code wich I found at http://aspn.activestate.com/ASPN/Co...T/Recipe/117251
wich was written by Brandon Croft

The part in italics is a just part of the working code, wich does the most of the transformation, so don't pay attention to it. (cause is already working)


If someone could help me with this pagination issue I will really appreciate it.

Thanks in advance.
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- tabglobal__ShowRecords.xsl -->
<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	version="1.0">
	<xsl:param name="sortKey" select="'consec'"/>
	<xsl:param name="sortOrder" select="'ascending'"/>
	<xsl:param name="Page" select="0"/>
	<xsl:param name="PageSize" select="5"/>

<xsl:template match="/xml/xml">
<xsl:apply-templates select="rows"/>
</xsl:template>	
	
<xsl:template match="rows">
<xsl:apply-templates select="row">
<xsl:sort select="*[name(.)=$sortKey]|@*[name(.)=$sortKey]" order="{$sortOrder}"/>
</xsl:apply-templates>
</xsl:template>


<xsl:template match="row">
<xsl:if test="position() >= ($Page * $PageSize) + 1">
<!-- Check to see if we have returned the right number of results yet. -->

	<xsl:if test="position() <= $PageSize + ($PageSize * $Page)">
	<!-- Do Some Work -->
		<xsl:choose>
		<xsl:when test="position() mod 2 > 0">
		</xsl:otherwise>
		</xsl:choose>
	<!-- ENDS Do Some Work -->

	</xsl:if>
</xsl:if>
</xsl:template>

</xsl:stylesheet>


The part of the code wich is between the <!-- Do Some Work --> is what actually formats the XML file to HTML, when I don't use that 2 conditions everything works fine, but when I try to apply the position conditions the server returns the following error, wich gets solved when I take this two conditions (in bold)
Code:
msxml4.dll error '80004005' 

The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document. 

/c4bcsrel/utilities/utilities.asp, line 386 


I am using ASP on IIS 5 with the MSXML2.FreeThreadedDOMDocument.4.0 and the MSXML2.XSLTemplate.4.0 implemented on a function wich I found at http://www.aspfree.com/authors/robe...ault.asp?aid=99 written by Robert Chartier
for applying the xsl file to the xml.

Reply With Quote
  #2  
Old March 4th, 2003, 09:40 PM
esosa esosa is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Mexicali Mexico
Posts: 23 esosa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to esosa
When I run the XSL transformation using XML Spy 5 with the MSXML XSL engine version 4 it says that
"The character < cannot be used in an attribute value"
it reffers to this part

<xsl:if test="position() <= $PageSize + ($PageSize * $Page)">

I don't know how to use the < in a comparation when is not allowed to be used, maybe there is a work around for this situation.

Any help will be appreciated.

Reply With Quote
  #3  
Old March 5th, 2003, 12:04 PM
esosa esosa is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Mexicali Mexico
Posts: 23 esosa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to esosa
The error is that you should use the &gt and & lt notation instead of the greater than and lower than sign when using it in numerical comparations, so the code should look like here bellow

<xsl:if test="position() <= $PageSize + ($PageSize * $Page)">


have funn.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XSL Pagination using MSXML DOM


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway