boen_robot Posted August 3, 2006 Share Posted August 3, 2006 Do I call the page.js from the HTML page or the XSLT? Or is HTML irrelevant with this? Link to comment Share on other sites More sharing options...
andreathedove Posted August 3, 2006 Author Share Posted August 3, 2006 Do I call the page.js from the HTML page or the XSLT? Or is HTML irrelevant with this?call the file page.js directly in xsl file before and after the header tag.<html><head><script language="javascript" src="page.js" /></head><body> Link to comment Share on other sites More sharing options...
boen_robot Posted August 3, 2006 Share Posted August 3, 2006 I seem to be missing something perhaps... The file page.js in the same directory as all of the files. It contains exactly what you showed without even a single alteration.In the XSLT, I changed the localLinkBefore and localLinkAfter parameters to this: <xsl:param name="localLinkBefore" select="'java script:changePage('"/> <xsl:param name="localLinkAfter" select="');'"/> and also, the root template now looks like this: <xsl:template match="/"> <html> <head> <style type="text/css"> .paginationNavigation, .paginationNavigation ul {text-align: center; margin: 0 auto; padding: 0;} .paginationNavigation ul, .paginationNavigation ul li {display: inline;} .paginationNavigation span, .paginationNavigation a {padding: 10px;} </style> <script type="text/javascript" src="page.js"></script> </head> <body> <xsl:apply-templates /> </body> </html> </xsl:template> The whole thing shows with no errors and the link's href is generated as expected. If typed directy, it would have looked like: <a href="java script:changePage(2);">Next</a> When I click on it however, nothing happens. Only a blink. As if the JavaScript accepts the parameter but doesn't do anything with it.I'm using IE7 and FF 1.5.0.6 and Opera 9 as test browsers.using "java script:changePage(2);" (notice the space) causes error 403 forbidden. What am I doing wrong?[edit] Solved. I just renamed "pagenumber" to "pageNumber" as it should be called .[/edit] Link to comment Share on other sites More sharing options...
andreathedove Posted August 3, 2006 Author Share Posted August 3, 2006 I seem to be missing something perhaps... The file page.js in the same directory as all of the files. It contains exactly what you showed without even a single alteration.In the XSLT, I changed the localLinkBefore and localLinkAfter parameters to this: <xsl:param name="localLinkBefore" select="'java script:changePage('"/> <xsl:param name="localLinkAfter" select="');'"/> and also, the root template now looks like this: <xsl:template match="/"> <html> <head> <style type="text/css"> .paginationNavigation, .paginationNavigation ul {text-align: center; margin: 0 auto; padding: 0;} .paginationNavigation ul, .paginationNavigation ul li {display: inline;} .paginationNavigation span, .paginationNavigation a {padding: 10px;} </style> <script type="text/javascript" src="page.js"></script> </head> <body> <xsl:apply-templates /> </body> </html> </xsl:template> The whole thing shows with no errors and the link's href is generated as expected. If typed directy, it would have looked like: <a href="java script:changePage(2);">Next</a> When I click on it however, nothing happens. Only a blink. As if the JavaScript accepts the parameter but doesn't do anything with it.I'm using IE7 and FF 1.5.0.6 and Opera 9 as test browsers.using "java script:changePage(2);" (notice the space) causes error 403 forbidden. What am I doing wrong?[edit] Solved. I just renamed "pagenumber" to "pageNumber" as it should be called .[/edit] Works ? Link to comment Share on other sites More sharing options...
boen_robot Posted August 3, 2006 Share Posted August 3, 2006 Yeah yeah. It does .Unfortunatly, it doesn't work if the XSLT is firstly called in HTML with the link I gave earlier. And the original application I needed the JavaScript solution on the first place used it. Oh well... in the worse scenario, I'll build the whole site on XML and XSLT only. No bad at it . Link to comment Share on other sites More sharing options...
andreathedove Posted August 4, 2006 Author Share Posted August 4, 2006 Yeah yeah. It does .Unfortunatly, it doesn't work if the XSLT is firstly called in HTML with the link I gave earlier. And the original application I needed the JavaScript solution on the first place used it. Oh well... in the worse scenario, I'll build the whole site on XML and XSLT only. No bad at it .want you built a web site with me ?NB I have more other questions to post: have I to open new post or post here? Link to comment Share on other sites More sharing options...
boen_robot Posted August 4, 2006 Share Posted August 4, 2006 want you built a web site with me ?NB I have more other questions to post: have I to open new post or post here? Unless it's related with this application, I would prefer a new topic. Otherwise, the whole thing might get lost in time.I wouldn't mind building a web site with your help. Considering the zero knowedge of JavaScript which I posses, I might need your help pretty soon . Infact, if you look at the topic for the execution script, you'll see I already do need help. I seem to be unable to use that execution script more then once. I need some way with which I can execute multiple XSLT transformations on a single HTML page. This is also part of the project I'm working on.The big problem for which it's been idle for so long were 2 reasons:1. The server doesn't have PHP and it's not going to.2. Until recently, I was unable to figure out how without PHP am I ever going to be preseting XML in parts. Thanks to you, that's no longer an issue. Link to comment Share on other sites More sharing options...
andreathedove Posted August 5, 2006 Author Share Posted August 5, 2006 Unless it's related with this application, I would prefer a new topic. Otherwise, the whole thing might get lost in time.I wouldn't mind building a web site with your help. Considering the zero knowedge of JavaScript which I posses, I might need your help pretty soon . Infact, if you look at the topic for the execution script, you'll see I already do need help. I seem to be unable to use that execution script more then once. I need some way with which I can execute multiple XSLT transformations on a single HTML page. This is also part of the project I'm working on.The big problem for which it's been idle for so long were 2 reasons:1. The server doesn't have PHP and it's not going to.2. Until recently, I was unable to figure out how without PHP am I ever going to be preseting XML in parts. Thanks to you, that's no longer an issue.... I need some way with which I can execute multiple XSLT transformations on a single HTML page. This is also part of the project I'm working on ...With an unic XML ? Link to comment Share on other sites More sharing options...
boen_robot Posted August 7, 2006 Share Posted August 7, 2006 Yes. Every XSLT with it's own XML pal as a pair. Why, does it matter? If only editing one or two variables would be enough, it shouldn't I think. Link to comment Share on other sites More sharing options...
andreathedove Posted August 7, 2006 Author Share Posted August 7, 2006 Yes. Every XSLT with it's own XML pal as a pair. Why, does it matter? If only editing one or two variables would be enough, it shouldn't I think.If it is possible for you, give me a list the problems you have, and I will help you.Andrea Link to comment Share on other sites More sharing options...
andreathedove Posted August 8, 2006 Author Share Posted August 8, 2006 If it is possible for you, give me a list the problems you have, and I will help you.AndreaEhi Link to comment Share on other sites More sharing options...
boen_robot Posted August 9, 2006 Share Posted August 9, 2006 Sorry. Problems with the ISP. Well, I described the problem(s) there, but if you insist: The script needs to be executed multiple times on each page, calling a different XML and/or XSLT each time, pretty much like an AJAX include. The script should degrade gracefully when JS is disabled. It's current form allows that functionality, but I'm saying this, so you could preserve it somehow. There is also a need for parameters in the XSLT to be changed by a click on a link generated by the XSLT. A really optional feature, but I have to mention it. If it's possible, the JavaScript should change parameters by handling a variable in the URL(a GET variable). This will make each page bookmarkable. Again I say it's optional. Having a fully functional client side application like this one is achievement on it's own. Link to comment Share on other sites More sharing options...
andreathedove Posted August 11, 2006 Author Share Posted August 11, 2006 Sorry. Problems with the ISP. Well, I described the problem(s) there, but if you insist:The script needs to be executed multiple times on each page, calling a different XML and/or XSLT each time, pretty much like an AJAX include. The script should degrade gracefully when JS is disabled. It's current form allows that functionality, but I'm saying this, so you could preserve it somehow. There is also a need for parameters in the XSLT to be changed by a click on a link generated by the XSLT. A really optional feature, but I have to mention it. If it's possible, the JavaScript should change parameters by handling a variable in the URL(a GET variable). This will make each page bookmarkable. Again I say it's optional. Having a fully functional client side application like this one is achievement on it's own. ... in other words you want a site in html e javascript and no asp and no php ?Andrea Link to comment Share on other sites More sharing options...
boen_robot Posted August 16, 2006 Share Posted August 16, 2006 ... in other words you want a site in html e javascript and no asp and no php ?AndreaYup. And the only missing thing in creating it is exactly including the common stuff without frames. Link to comment Share on other sites More sharing options...
andreathedove Posted August 26, 2006 Author Share Posted August 26, 2006 Yup. And the only missing thing in creating it is exactly including the common stuff without frames.Hello boen_robot,how are you ? Andrea Link to comment Share on other sites More sharing options...
andreathedove Posted August 26, 2006 Author Share Posted August 26, 2006 Hello boen_robot,how are you ? Andrea... I am sorry to help you, but in this day my pc had problems, and now all is ok.Andrea Link to comment Share on other sites More sharing options...
andreathedove Posted August 31, 2006 Author Share Posted August 31, 2006 Sorry. Problems with the ISP. Well, I described the problem(s) there, but if you insist:The script needs to be executed multiple times on each page, calling a different XML and/or XSLT each time, pretty much like an AJAX include. The script should degrade gracefully when JS is disabled. It's current form allows that functionality, but I'm saying this, so you could preserve it somehow. There is also a need for parameters in the XSLT to be changed by a click on a link generated by the XSLT. A really optional feature, but I have to mention it. If it's possible, the JavaScript should change parameters by handling a variable in the URL(a GET variable). This will make each page bookmarkable. Again I say it's optional. Having a fully functional client side application like this one is achievement on it's own. I am studying your problems.[*]The script needs to be executed multiple times on each page, ...I no understand ? give me an example ... calling a different XML and/or XSLT each time, ok ... pretty much like an AJAX include.ok AndreaPS: yOU DON'T ANGRY WITH ME FOR THE DELAY Link to comment Share on other sites More sharing options...
boen_robot Posted August 31, 2006 Share Posted August 31, 2006 Of course not. You've been busy (or something...) and there were times I have been too. How can I be angry about it?Your english however seems to get worse with your every post though. What's going on?Anyway... what I mean by "The script needs to be executed multiple times on each page" is that similarly to the AJAX include that does something like: <script type="text/javascript">ajaxinclude('header.html')</script><script type="text/javascript">ajaxinclude('navigation.html')</script><script type="text/javascript">ajaxinclude('additional.html')</script><script type="text/javascript">ajaxinclude('footer.html')</script> The new script needs to do it's thing like: <div id="transformation1">This is the text you'll see if transformation1 fails</div><div id="transformation2">This is the text you'll see if transformation2 fails</div><div id="transformation3">This is the text you'll see if transformation3 fails</div><div id="transformation4">This is the text you'll see if transformation4 fails</div> Where transformationN is associated with a certain pair of XML and XSLT. For example, it could be:transformation1 uses file1.xml and file1.xsltransformation2 uses file2.xml and file1.xsltransformation3 uses file1.xml and file2.xsltransformation4 uses file2.xml and file2.xslYou see that in both examples, the script is called not once but 4 times. That's what "multiple" means (if that was the word to confuse you): more then a one time. Link to comment Share on other sites More sharing options...
andreathedove Posted February 2, 2008 Author Share Posted February 2, 2008 Asp solution: <%' prevent page cachingResponse.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1 number = Request.QueryString("n")if number = "" thennumber = "1"end ifxslpath = Server.mappath("test.xsl")sourceFile = Server.mappath("test.xml") Set source = Server.CreateObject("Msxml2.DOMDocument") source.async = false source.load(sourceFile)set xsldoc = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")xsldoc.async = falsexsldoc.load(xslpath) set xsltemp = Server.createObject("MSXML2.XSLTemplate")xsltemp.stylesheet=xsldocset xslproc = xsltemp.createProcessorxslproc.input=sourcexslproc.output=Response' parameter for message groupxslproc.addParameter "pagenumber",numberxslproc.transformResponse.end%> Hello,how I can paging the XML with XSL style google ?Andrea Link to comment Share on other sites More sharing options...
boen_robot Posted February 2, 2008 Share Posted February 2, 2008 Hello,how I can paging the XML with XSL style google ?AndreaSorry, I don't follow. Wasn't that what we were discussing in this topic long ago? Link to comment Share on other sites More sharing options...
andreathedove Posted February 2, 2008 Author Share Posted February 2, 2008 Sorry, I don't follow. Wasn't that what we were discussing in this topic long ago?Hello,if I have 1000 item in a xml file, how I can paging:item PerPage = 10TotalItem = 1000so 1000/10 = 100I should want to have this result:1-10 11-20 21-30 and so on ...Andrea Link to comment Share on other sites More sharing options...
boen_robot Posted February 2, 2008 Share Posted February 2, 2008 You specify "$recordsPerPage = 100" as we did earlier, and that's it.BTW, a lot of time has passed since we had this discussion. I've realized that using XSLT for pagination is just not very efficient, as the whole XML file needs to be loaded into memory.With your 1000 records, if your XML is 4MBs, you're likely consuming at least 16MBs... that plus the XSLT's DOM representation, the XSLT processor and everything. And that for every request to the page. Link to comment Share on other sites More sharing options...
andreathedove Posted February 2, 2008 Author Share Posted February 2, 2008 You specify "$recordsPerPage = 100" as we did earlier, and that's it.BTW, a lot of time has passed since we had this discussion. I've realized that using XSLT for pagination is just not very efficient, as the whole XML file needs to be loaded into memory.With your 1000 records, if your XML is 4MBs, you're likely consuming at least 16MBs... that plus the XSLT's DOM representation, the XSLT processor and everything. And that for every request to the page.Here you find an example:http://www.t-dreams.com/AccountantPage/gue...t.asp?cmd=resetAndrea Link to comment Share on other sites More sharing options...
boen_robot Posted February 2, 2008 Share Posted February 2, 2008 And here's your own example.It's the same deal, but with a higher number for $recordsPerPage!If what you want to do is an interval (11-20), then you could adjust <xsl:variable name="pageNumberControl" select="count(preceding-sibling::*)+1" /> to something like <xsl:variable name="pageNumberControl" select="concat(count(preceding-sibling::*) + position() , '-', count(preceding-sibling::*) + $recordsPerPage)" /> (I think) Link to comment Share on other sites More sharing options...
andreathedove Posted February 8, 2008 Author Share Posted February 8, 2008 And here's your own example.It's the same deal, but with a higher number for $recordsPerPage!If what you want to do is an interval (11-20), then you could adjust<xsl:variable name="pageNumberControl" select="count(preceding-sibling::*)+1" /> to something like <xsl:variable name="pageNumberControl" select="concat(count(preceding-sibling::*) + position() , '-', count(preceding-sibling::*) + $recordsPerPage)" /> (I think) Hello,i am working here: http://www.allinonenet.it/compra_e_vendi/r...donna_e_bambinoAnd I have record per page "1", and with this code dont work:<xsl:template name="footerPages"><xsl:param name="element" /><xsl:param name="pagenumber" /><xsl:variable name="total" select="count(//products/product/mCN[count(. | key('jobcode', text())[1]) = 1]) div $recordsPerPage"/><center><xsl:if test="$pagenumber > 1"><a href="?n={$pagenumber -1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}">Indietro</a></xsl:if><xsl:for-each select="*[name() = $element and position() <= ceiling($total)]"><xsl:choose><xsl:when test="not(count(preceding-sibling::*)+1 = $pagenumber)"> [<a href="?n={count(preceding-sibling::*)+1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}"><xsl:value-of select="count(preceding-sibling::*)+1" /></a>]</xsl:when><xsl:otherwise> <b>[<xsl:value-of select="count(preceding-sibling::*)+1" />]</b></xsl:otherwise></xsl:choose></xsl:for-each><xsl:if test="$pagenumber < $total"> <a href="?n={$pagenumber +1}&id={$id}&Cat={$category}&r={translate($r,' ' ,'_')}">Avanti</a></xsl:if></center><xsl:variable name="pageNumberControl" select="concat(count(preceding-sibling::*) + position() , '-', count(preceding-sibling::*) + $recordsPerPage)" /></xsl:template> Andrea Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now