APConnextion
asked on
Help with pagination in xsl file?
I was peeking at some other pagination posts, and couldn't quite figure out how to fit the xsl pagination into the code. How can I paginate the code in xsl, say, 6 records per page, with previous and next buttons or links for the user?
The top of my code currently looks like this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-m icrosoft-c om:xslt" xmlns:fx="#fx-functions" exclude-result-prefixes="m sxsl fx">
<xsl:output method="html" version="4.0" indent="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:template match="//dataroot" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset =UTF-8"/>
<title>scv-central</title>
<style type="text/css">
</style>
</head>
<body link="#0000ff" vlink="#800080">
<xsl:variable name="GlobalGroup" select="Qscv-central"/>
<!-- Calculate expressions and running sums -->
<xsl:value-of select="fx:CalculateExpres sions_Glob al($Global Group[1], $GlobalGroup)"/>
<div style="BORDER-STYLE: none; WIDTH: 3.5in; BACKGROUND-COLOR: #ece9d8; VISIBILITY: visible; HEIGHT: 0in; POSITION: relative">
</div>
<xsl:for-each select="Qscv-central">
<xsl:sort select="Area" order="ascending" data-type="text"/>
<xsl:sort select="Rent" order="ascending" data-type="number"/>
<!-- Calculate expressions and running sums -->
<xsl:value-of select="fx:CalculateExpres sions_Deta il(., $GlobalGroup)"/>
<div style="BORDER-STYLE: none; WIDTH: 3.5in; BACKGROUND-COLOR: #ebebeb; VISIBILITY: visible; HEIGHT: 3.25in; POSITION: relative">
<span class="Style0" style="LEFT: 0.0833in; TOP: 0.0833in; WIDTH: 0.6666in; HEIGHT: 0.177in; POSITION: absolute">
<xsl:value-of select="Area"/>
</span>
<span class="Style1" style="LEFT: 1.8229in; TOP: 0.0729in; WIDTH: 1.6041in; HEIGHT: 0.1875in; OVERFLOW: hidden; POSITION: absolute">
<xsl:value-of select="Address"/>
</span>
It goes on from there. And the xml for one record looks like this (there are more fields in each record, but I just made it shorter for expediency purposes):
<Qscv-central>
<Print>1</Print>
<SMA>SCV</SMA>
<New>0</New>
<SS>0</SS>
<Area>Central</Area>
<Address>1701 Industrial Street</Address>
<Rent>0</Rent>
</Qscv-central>
Thank you!
The top of my code currently looks like this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-m
<xsl:output method="html" version="4.0" indent="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:template match="//dataroot" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset
<title>scv-central</title>
<style type="text/css">
</style>
</head>
<body link="#0000ff" vlink="#800080">
<xsl:variable name="GlobalGroup" select="Qscv-central"/>
<!-- Calculate expressions and running sums -->
<xsl:value-of select="fx:CalculateExpres
<div style="BORDER-STYLE: none; WIDTH: 3.5in; BACKGROUND-COLOR: #ece9d8; VISIBILITY: visible; HEIGHT: 0in; POSITION: relative">
</div>
<xsl:for-each select="Qscv-central">
<xsl:sort select="Area" order="ascending" data-type="text"/>
<xsl:sort select="Rent" order="ascending" data-type="number"/>
<!-- Calculate expressions and running sums -->
<xsl:value-of select="fx:CalculateExpres
<div style="BORDER-STYLE: none; WIDTH: 3.5in; BACKGROUND-COLOR: #ebebeb; VISIBILITY: visible; HEIGHT: 3.25in; POSITION: relative">
<span class="Style0" style="LEFT: 0.0833in; TOP: 0.0833in; WIDTH: 0.6666in; HEIGHT: 0.177in; POSITION: absolute">
<xsl:value-of select="Area"/>
</span>
<span class="Style1" style="LEFT: 1.8229in; TOP: 0.0729in; WIDTH: 1.6041in; HEIGHT: 0.1875in; OVERFLOW: hidden; POSITION: absolute">
<xsl:value-of select="Address"/>
</span>
It goes on from there. And the xml for one record looks like this (there are more fields in each record, but I just made it shorter for expediency purposes):
<Qscv-central>
<Print>1</Print>
<SMA>SCV</SMA>
<New>0</New>
<SS>0</SS>
<Area>Central</Area>
<Address>1701 Industrial Street</Address>
<Rent>0</Rent>
</Qscv-central>
Thank you!
ASKER
I peeked at those. I ended up using this:
https://www.experts-exchange.com/questions/20537316/pagination-in-XSL.html?query=pagination+in+xml&clearTAFilter=true
But it's coming up with an error that says:
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.
/scv/central.asp, line 21
Can someone help me with this? My xsl now looks like this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet[
<!ENTITY newLine " ">
<!ENTITY headerCo " CENTRAL REPORT Page: ">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-m icrosoft-c om:xslt" xmlns:fx="#fx-functions" exclude-result-prefixes="m sxsl fx">
<xsl:output method="html" version="4.0" indent="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:param name= "numberperpage" select="3" />
<xsl:template match="//dataroot" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset =UTF-8"/>
<title>scv-central</title>
<style type="text/css">
</style>
</head>
<body link="#0000ff" vlink="#800080">
<xsl:variable name="GlobalGroup" select="Qscv-central"/>
<!-- Calculate expressions and running sums -->
<xsl:value-of select="fx:CalculateExpres sions_Glob al($Global Group[1], $GlobalGroup)"/>
<div style="BORDER-STYLE: none; WIDTH: 3.5in; BACKGROUND-COLOR: #ece9d8; VISIBILITY: visible; HEIGHT: 0in; POSITION: relative">
</div>
<xsl:for-each select="Qscv-central">
<xsl:sort select="Area" order="ascending" data-type="text"/>
<xsl:sort select="Rent" order="ascending" data-type="number"/>
<!-- Calculate expressions and running sums -->
<xsl:value-of select="fx:CalculateExpres sions_Deta il(., $GlobalGroup)"/>
<xsl:if test="position() mod $numberperpage = 1"><xsl:text>&headerCo;</x sl:text><x sl:value-o f select="((position() + $numberperpage)-1) div $numberperpage"/>
<xsl:text>&newLine;</xsl:t ext>
</xsl:if>
The asp page looks like this:
<%
Set objData = CreateDOM
objData.async = false
if (false) then
Set objDataXMLHTTP = Server.CreateObject("Micro soft.XMLHT TP")
objDataXMLHTTP.open "GET", "", false
objDataXMLHTTP.setRequestH eader "Content-Type", "text/xml"
objDataXMLHTTP.send
objData.load(objDataXMLHTT P.response Body)
else
objData.load(Server.MapPat h("Central .xml"))
end if
Set objStyle = CreateDOM
objStyle.async = false
objStyle.load(Server.MapPa th("Centra l.xsl"))
Session.CodePage = 65001
Response.ContentType = "text/html"
Response.Write objData.transformNode(objS tyle)
Function CreateDOM()
On Error Resume Next
Dim tmpDOM
Set tmpDOM = Nothing
Set tmpDOM = Server.CreateObject("MSXML 2.DOMDocum ent.5.0")
If tmpDOM Is Nothing Then
Set tmpDOM = Server.CreateObject("MSXML 2.DOMDocum ent.4.0")
End If
If tmpDOM Is Nothing Then
Set tmpDOM = Server.CreateObject("MSXML .DOMDocume nt")
End If
Set CreateDOM = tmpDOM
End Function
%>
Does someone know what I'm missing? I know it has to be close . . .
https://www.experts-exchange.com/questions/20537316/pagination-in-XSL.html?query=pagination+in+xml&clearTAFilter=true
But it's coming up with an error that says:
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.
/scv/central.asp, line 21
Can someone help me with this? My xsl now looks like this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet[
<!ENTITY newLine " ">
<!ENTITY headerCo " CENTRAL REPORT Page: ">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-m
<xsl:output method="html" version="4.0" indent="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<xsl:param name= "numberperpage" select="3" />
<xsl:template match="//dataroot" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset
<title>scv-central</title>
<style type="text/css">
</style>
</head>
<body link="#0000ff" vlink="#800080">
<xsl:variable name="GlobalGroup" select="Qscv-central"/>
<!-- Calculate expressions and running sums -->
<xsl:value-of select="fx:CalculateExpres
<div style="BORDER-STYLE: none; WIDTH: 3.5in; BACKGROUND-COLOR: #ece9d8; VISIBILITY: visible; HEIGHT: 0in; POSITION: relative">
</div>
<xsl:for-each select="Qscv-central">
<xsl:sort select="Area" order="ascending" data-type="text"/>
<xsl:sort select="Rent" order="ascending" data-type="number"/>
<!-- Calculate expressions and running sums -->
<xsl:value-of select="fx:CalculateExpres
<xsl:if test="position() mod $numberperpage = 1"><xsl:text>&headerCo;</x
<xsl:text>&newLine;</xsl:t
</xsl:if>
The asp page looks like this:
<%
Set objData = CreateDOM
objData.async = false
if (false) then
Set objDataXMLHTTP = Server.CreateObject("Micro
objDataXMLHTTP.open "GET", "", false
objDataXMLHTTP.setRequestH
objDataXMLHTTP.send
objData.load(objDataXMLHTT
else
objData.load(Server.MapPat
end if
Set objStyle = CreateDOM
objStyle.async = false
objStyle.load(Server.MapPa
Session.CodePage = 65001
Response.ContentType = "text/html"
Response.Write objData.transformNode(objS
Function CreateDOM()
On Error Resume Next
Dim tmpDOM
Set tmpDOM = Nothing
Set tmpDOM = Server.CreateObject("MSXML
If tmpDOM Is Nothing Then
Set tmpDOM = Server.CreateObject("MSXML
End If
If tmpDOM Is Nothing Then
Set tmpDOM = Server.CreateObject("MSXML
End If
Set CreateDOM = tmpDOM
End Function
%>
Does someone know what I'm missing? I know it has to be close . . .
ASKER
And I still don't know about the next and previous links . . .
msxml4.dll error '80004005'
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q316297
CAUSE
The content model of a type definition in the XSD is non-deterministic (ambiguous). For additional information about deterministic content models, see the "More Information" section of this article.
RESOLUTION
Identify the type definition that contains the non-deterministic content model and make the changes required to make the content model deterministic (unambiguous).
In plain english, the definition of your xsl has a problem. I will look for it on my end also, but I wanted to get this up so you can read it.
Duane
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q316297
CAUSE
The content model of a type definition in the XSD is non-deterministic (ambiguous). For additional information about deterministic content models, see the "More Information" section of this article.
RESOLUTION
Identify the type definition that contains the non-deterministic content model and make the changes required to make the content model deterministic (unambiguous).
In plain english, the definition of your xsl has a problem. I will look for it on my end also, but I wanted to get this up so you can read it.
Duane
ASKER
Thank you Duane. It seemed to stem from adding the DOCTYPE section at the top of the xsl document. Before I added that (and the corresponding bits a little further down the xsl), it came up without an error, but put the number 1, then three records, then the number 2, and three records, and so on. Not on seperate pages, tho. Just scrolling down. It divided them into three's and numbered them.
Do you know how we can fix this? Your help is much appreciated.
Do you know how we can fix this? Your help is much appreciated.
ASKER
Actually, I don't think this code is doing what I want it to. How do I get a page break in there after the groups of records and have previous and next links for the pages? Help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will take a look at that. My apologies for taking your time. I've appreciated your help though. And I've been doing quite a bit of reading, on and offline. Hundreds of pages trying to figure out how to make this and numerous other things happen. Mainly dealing with XML, VB, and PHP.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.perfectxml.com/XSLFO.asp
http://forums.devshed.com/t54150/s.html
Duane