Sign Up
Search
Options
search
Chat
Help
News
Log in
Not Logged in
Home
»
Boards
»
Stylus Studio Developer Network
»
XSLT Help and Discussion
»
Paging with XSL and passing URL parameter (using javascript)
Conferences
Stylus Studio Feature Requests
(1192)
Stylus Studio Technical Forum
(14621)
Website Feedback
(249)
XSLT Help and Discussion
(7625)
Use of before and after string
(3)
How do I substitute element ty...
(1)
How does one add working days ...
(4)
Help, I have existing XLT and...
(1)
Need help on XSLT issue -
(2)
EDI to XML Conversion
(7)
XML To JSON Conversion using X...
(1)
Formatting Paragraphs to same ...
(2)
Grouping of records
(1)
Problems with xsd 1.1
(4)
XML to HL7 mapping
(3)
XSLT 3 and Iterate
(2)
XSL-FO to PDF preview
(3)
java.lang.RuntimeException: Er...
(2)
Create Acroforms with Stylus X...
(2)
How to change XSLT parameter s...
(3)
how to change format of the da...
(2)
Search "Next 8 Results " doesn...
(2)
Support for Git
(1)
newbee
(8)
[1-20]
[21-40]
[41-60]
Next
XQuery Help and Discussion
(2017)
Stylus Studio FAQs
(159)
Stylus Studio Code Samples & Utilities
(364)
Stylus Studio Announcements
(113)
Topic
next
Subject:
Paging with XSL and passing URL parameter (using javascript)
Author:
Yama Kamyar
Date:
22 Sep 2008 01:57 PM
Originally Posted: 19 Sep 2008 01:27 PM
Hi,
I have a very large XML file in CruiseControl.NET 1.4 which I want to display its data to the browser.
In my XSL I have created the following:
<xsl:param name="pageNumber" select="0" />
When the user clicks on a "Next" link the page is refreshed with the addition of
http://server/page.aspx?pageNumber=2
I have tried using msxml:script but it did not work because it complained about a javascript object: window.location.href. The error was it could not locate 'window' object or something like that.
ALL I want is when the page refreshes I get:
the value of pageNumber
http://server/page.aspx?pageNumber=2
populate this:
<xsl:param name="pageNumber" select="2" />
Very pretty straight forward but could not figure out how... I searched everywhere on the web and could not find anything.
Is there a solution you know of?
Thanks,
Yama
top
Subject:
Paging with XSL and passing URL parameter (using javascript)
Author:
Yama Kamyar
Date:
22 Sep 2008 01:59 PM
Originally Posted: 19 Sep 2008 05:40 PM
for those of you who think this wasn't possibly... Here is the solution:
<xsl:stylesheet
version="1.0"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:csharp="
http://csharp"
exclude-result-prefixes="xsl msxml csharp">
<msxml:script implements-prefix="csharp" language="C#">
<msxml:using namespace="System.Collections"/>
<msxml:assembly name="System.Web"/>
<msxml:using namespace="System.Web"/>
<![CDATA[
public int GetPageNumber() {
int page = 0;
if(HttpContext.Current.Request.QueryString["pageNumber"] != null)
{
if(HttpContext.Current.Request.QueryString["pageNumber"].Length > 0)
{
page = Convert.ToInt32(HttpContext.Current.Request.QueryString["pageNumber"]);
}
}
return page;
}
]]>
</msxml:script>
<xsl:output method="html"/>
<xsl:template match="/">
<script type="text/javascript">
function foo()
{ return "your javascript here"; }
</script>
<style type="text/css">
body {
font:normal 88% verdana,arial,helvetica;
color:#000000;
}
table tr td, tr th {
font-size: 88%;
}
</stlye>
</xsl:template>
<xsl:template match="files">
<xsl:param name="recordsPerPage" select="10" />
<xsl:param name="pageNumber" select="number(csharp:GetPageNumber())" />
<xsl:param name="recordCount" select="count(//file)" />
<xsl:for-each select="//file">
<xsl:if test="position() > $recordsPerPage * number($pageNumber) and
position() <= number($recordsPerPage * number($pageNumber) +
$recordsPerPage)">
<!-- Display 50Mb XML -->
</xsl:if>
</xsl:for-each>
<span style="Z-INDEX: 101; LEFT: 261px; WIDTH: 501px;">
<xsl:if test="$pageNumber > 0">
<xsl:element name="a">
<xsl:attribute name="href">?pagenumber=<xsl:value-of select="number($pageNumber)-1" />
</xsl:attribute>
<< Previous Page
</xsl:element>
       
</xsl:if>
<xsl:if test="($recordCount - ((1+number($pageNumber)) * $recordsPerPage))> 0">
<xsl:element name="a">
<xsl:attribute name="href">?pagenumber=<xsl:value-of select="number($pageNumber)+1" />
</xsl:attribute>
Next page >>
</xsl:element>
</xsl:if>
</span>
</xsl:template>
Hope this helps many others. Please let me know if anyone has questions.
Yama Kamyar
Powered by
Stylus Studio
, the world's leading
XML IDE
for
XML
,
XSLT
,
XQuery
,
XML Schema
,
DTD
,
XPath
,
WSDL
,
XHTML
,
SQL/XML
, and
XML Mapping
!
Go to Conference:
Select Conference
Stylus Studio Feature Requests
Stylus Studio Technical Forum
Website Feedback
XSLT Help and Discussion
XQuery Help and Discussion
Stylus Studio FAQs
Stylus Studio Code Samples & Utilities
Stylus Studio Announcements
go
Log In Options
Username:
Password:
Site Map
|
Privacy Policy
|
Terms of Use
|
Trademarks
Stylus Scoop XML Newsletter:
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.