andreathedove
-
Posts
119 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by andreathedove
-
-
This is my XSLT Page:What is the full XSLT you have? It seems you've steered away from the pagination framework I once gave you, and after all, the idea behind it was exactly so that you can later more easily develop pages that required pagination.<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:zylom="http://www.zylomgames.com/rss/partnerprogram/"> <xsl:output method="html" encoding="ISO-8859-1"/> <xsl:param name="pagenumber" select="0" /> <xsl:variable name="recordsPerPage" select="10" /> <xsl:param name="category"/> <xsl:param name="r"/> <xsl:param name="id"/> <xsl:key name="jobcode" match="mCN" use="text()" /> <xsl:key name="job" match="programLogoPath" use="text()" /> <xsl:key name="prezzo" match="price" use="text()" /> <xsl:template match = "*"><xsl:variable name="totale" select="count(//products/product[mCN=translate($r,'_' ,' ')])"/> <div id="dir"> <strong><xsl:value-of select="$r"/></strong> - <b>[ <xsl:value-of select="$totale"/> ]</b><br/><br/><table><xsl:for-each select="//products/product[mCN=translate($r,'_' ,' ')]"><xsl:sort select="text()" data-type="text" order="ascending"/> <xsl:if test="position() >= (($pagenumber - 1) *$recordsPerPage) and position() <= ($pagenumber * $recordsPerPage)"><xsl:variable name="tot" select="count(key('jobcode',text()))"/><xsl:variable name="selezione" select="substring-after(text(),':')"/><tr><td><img src="{iU}" width='50px' height='59px'/></td><td> <a class="titoli" href="prodotti.asp?id={$id}&Cat={$category}&r={translate(text(),' ' ,'_')}"><b><xsl:value-of select="n"/></b></a><br/><xsl:value-of select="d"/></td><td> <b> <xsl:value-of select="p"/></b><br/>Spese: <xsl:value-of select="sC"/><br/>Condizioni: <xsl:value-of select="con"/><br/>Totale: <xsl:value-of select="p + sC"/></td></tr></xsl:if> </xsl:for-each></table></div> <xsl:call-template name="footerPages"><xsl:with-param name="element" select="'product'" /><xsl:with-param name="pagenumber" select="$pagenumber" /></xsl:call-template></xsl:template><xsl:template name="footerPages"><xsl:param name="element" /><xsl:param name="pagenumber" /><xsl:variable name="total" select="count(//products/product[mCN=translate($r,'_' ,' ')]) 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></xsl:stylesheet>
Andrea
-
Hello,nobody can you help me ? :-(AndreaHello,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
-
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: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)
<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
-
Here you find an example:http://www.t-dreams.com/AccountantPage/gue...t.asp?cmd=resetAndreaYou 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. -
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 ...AndreaSorry, I don't follow. Wasn't that what we were discussing in this topic long ago? -
Hello,how I can paging the XML with XSL style google ?AndreaAsp 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%>
-
ASP and XML
in ASP
Hello,exist a function or a simply script that allow to read multy xml?Thanks,Andrea
-
thanks
-
-
Hello,I resolved the problem with:set xmlcontents = objXML.getelementsbytagname("item")AndreaPS: I have a special request in xslt and xml that interests to all, I should post here?
-
Hello All,I have problem witk this Feed Rss powered by Google News:http://www.google.it/news?ned=it&topic=b&output=rssI write to read the node this code:<!--#include file="config.asp" --><%dim objXMLset objXML = server.CreateObject("Microsoft.FreeThreadedXMLDOM")objXML.Load(xmlpath)set xmlcontents = objXML.DocumentElement.selectSingleNode("channel")%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><div align="center"> <table width="75%" border="1" bordercolor="#E3E7E8"> <tr> <td colspan="4"> </td> </tr><%for i = 0 to xmlcontents.ChildNodes.length - 1 set xmlcontent = xmlcontents.ChildNodes.item(i)%> <tr> <td><%= xmlcontent.ChildNodes.item(0).text%></td> <td><%= xmlcontent.ChildNodes.item(1).text%></td> <td><%= xmlcontent.ChildNodes.item(2).text%></td> </tr> <% next %></table> </div></body></html>I set documentelement in Channel but I have this error:http://www.allinonenet.it/inc_home/google_...oogle_news2.aspWhy ?
-
How I can ?
in XML
Thanks
-
How I can ?
in XML
Hello,how are you ?Help me please ... I have this Node:<link rel="alternate" type="text/html" href="http://www.lastampa.it/redazione/cmsSezioni/politica/200703articoli/18786girata.asp" /> To read the link http://www.lastampa.it/redazione/cmsSezion...18786girata.asp I try:Set col = xmldom.getElementsByTagName("entry/link[@href=]")But don't work why?Thanks,Andrea
-
I am studying your problems.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.
- [*]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
-
... I am sorry to help you, but in this day my pc had problems, and now all is ok.AndreaHello boen_robot,how are you ? Andrea -
Hello boen_robot,how are you ? AndreaYup. And the only missing thing in creating it is exactly including the common stuff without frames. -
I have resolved the problemhow to eliminate ? :)with your code the result in html are<td bordercolor="#FFFFFF" width="*" valign="top" align="left"><a class="testo" href="shopping_cat.asp?Cat="><b></b></a><br></td> ...etc ...Andrea -
how to eliminate ?Oh, I see. Sorry. Well, it seems this is generated for the cases where the <category> element is not present.If you want to have something like "Unknown category" identfier, you should use something like:<xsl:for-each select="/rss/channel/item[not(category = preceding-sibling::item/category)]"> <xsl:sort select="category" data-type="text" order="ascending"/> <td bordercolor="#FFFFFF" width="200" valign="top" align="left"> <xsl:choose><xsl:when test="category"><a class="testo" href="shopping_cat.asp?Cat={category}"><b><xsl:value-of select="category"/></b></a></xsl:when><xsl:otherwise><a class="testo" href="shopping_cat.asp?Cat=~Unknown"><b>~Uknown~</b></a></xsl:otherwise></xsl:choose>[ ] <br/> </td> <xsl:if test="position() mod 1 = 0"> <!-- Blocco CDATA assieme a codice Javascript --> <script> <![CDATA[document.write("</tr><tr>");]]> </script> <!-- FINE Blocco CDATA assieme a codice Javascript --> </xsl:if> </xsl:for-each>
And to eliminate the articles with unknown category, just use <xsl:if> instead.I can already think of a lot more elegant solution then this one, but considering the bad state of this code (tables, weird scripts, etc.) I would prefer to keep it in my own bag'o'tricks.
with your code the result in html are<td bordercolor="#FFFFFF" width="*" valign="top" align="left"><a class="testo" href="shopping_cat.asp?Cat="><b></b></a><br></td> ...etc ...Andreahow to eliminate ? -
... in other words you want a site in html e javascript and no asp and no php ?AndreaSorry. 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.
-
toc tocand if the xml have not the same structure ?... and then for read a single element, what about ?Andrea -
EhiIf it is possible for you, give me a list the problems you have, and I will help you.Andrea -
If it is possible for you, give me a list the problems you have, and I will help you.AndreaYes. 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. -
and if the xml have not the same structure ?... and then for read a single element, what about ?AndreaSimple enough, scince both XMLs have the same type of structure...<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <firma> <xsl:apply-templates/> </firma> </xsl:template> <xsl:template match="/firma"> <xsl:copy-of select="."/> <xsl:copy-of select="document('xml2.xml')/firma"/> </xsl:template></xsl:stylesheet>
-
... 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 ?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.
paging XML
in XSLT/XSL-FO
Posted