Jump to content

boen_robot

Members
  • Posts

    8,493
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by boen_robot

  1. Do I call the page.js from the HTML page or the XSLT? Or is HTML irrelevant with this?
  2. OK. I don't know regular expressions enough to know that, so what's the "/is" for? I've also noticed the last expression ends with /i instead. What's this indicating? case (in)sencetivity?
  3. I don't know why, but it reminds me too much of dcole.ath.cx.
  4. I haven't looked through your codes, but considering your screenshots, I gather you need to set display:block; whenever an element is suppose to be on a new row.Please, post your codes as text. It makes it a lot easier.
  5. There are things known as exclusions you know... just enable the certain PCs to access yours.
  6. Now if you can only do a JavaScript way to use this, I can safely call you "JavaScript god" with no doubt .This time, I won't forget to give you the cross browser JavaScript code to execute XSLT transofmration inside HTML. The problem is to somehow pass the parameter (not necessary in the URL) that indicates the pageNumber and the such.
  7. Yes. float: left; positions the object to the up left of it's container and float:right;... yes... up right to it. The next object is placed next to the floating one, unless there's a "clear" on that following object. If there is, the object is positioned below the floating one.
  8. Standarts do support useful things. What you're talking is "browser support", not "standarts support". There's a huge difference between the two and the only buggy browser is IE. That's why it's better to debug it's problems then to design per-browser stylesheets: all user agents (not only desktop browsers) will be able to see your application as they should and they won't be affected by the IE fixes, if you do them right (with conditional comments...).
  9. Look, in the paging XML script, just change the path /*/*[name()=$pagedElement] and the such, to /*/*/*[name()=$pagedElement] or simply //*[name()=$pagedElement] And you'll have the RSS fead read.In other words, instead of reading the root element(/rss), you must read the one below it (/rss/channel) and that's it. Nothing more special.One more very frequent use case of that creature.
  10. Oh, and thanks to kvnmck18, I'm also able to present the PHP4 (Salbotron) solution. <?php//Prepare the variables.//This is especially usefull if you only want to rename their name in the URL while keeping their functionality.$pageNumber = $_GET['n'];$xsltFile = "test.xsl";$xmlFile = "test.xml";//Prepare parameter changesif (ereg("^[1-9]*[0-9]", $pageNumber)) //Ensure the $pageNumber is really a number{$args = array("pageNumber" => $pageNumber);}//Load the XSLT processor$engine = xslt_create();//Execute the transformation$output = xslt_process($engine, $xmlFile, $xsltFile, NULL, NULL, $args);//Show the transformation in the browser. Just before this phase is the right time to check the output if needed.print $output;xslt_free($engine);?> And I'm still waiting for ASP and JavaScript solutions .
  11. You're asking if you can jump the channel content. I'm saying you can, and I'm asking (rithorically) why wouldn't you be able to.
  12. Comparing the substrings one by one would be simpler then transforming them and comparing the results. For example, you would first check which year is more recent. If an year is, then it's sure the whole date is. If they're equial, compare the months and so on. If you want to sort multiple elements according to their date, you must divide your date and time in a manner simmilar to what I showed in my previous post and apply multiple <xsl:sort> for each element. I'm just not into codewriting right now, but I hope you get my idea.
  13. You mean you're not only going to compare date numbers but also strings (month names perhaps?)?!?! This makes it double harder. You have to assign each month's substring to a number and compare that number instead.... It's all waaay too complicated. Dividing your dates into elements or attributes would make it a bit easier: <date><day>1</day><month>2</month><year>2006</year></date><time><second>34<second><minutes>13</minutes><hours>16</hours></time>
  14. The date and time functions are part of XPath 2. Thus, they are not supported in any browser yet. The only way I know you can do it now is with the substring() function, but considering the large amount of data to be compared, this would take a lot of substing() to complete.
  15. What do you mean by "streaming"? Online video/audio watching/listening? If that's the case, you need to use the <object> tag to create a player in the browser. The browser itself should do the streaming part. Read the media tutorial for details about the <object> element.
  16. boen_robot

    How to ?

    I don't get it... the changing works, yes, and you want to have what? This same function? Turn off the controls of the paging XML script, rename the HTML wrapper to RSS one and create a GET variable that will manipulate the recordsPerPage parameter.Cases like this one are exactly the reason why I said (before the hacracking) that this is the most beautiful application I've seen. It simply allows you a HUGE variety of actions within few simple XSLT editings.
  17. Add the desired extension(s) to this row: AddType application/x-httpd-php .php For example, if you want .html files to be parsed as PHP ones, you would change the above row to: AddType application/x-httpd-php .php .html
  18. Here's the new and all improved XSLT: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!--These variables are the easiest to change outside the XSLT--> <xsl:param name="pageNumber" select="1" /> <xsl:param name="recordsPerPage" select="5" /> <!--It's neccesary to change this in order to use this XSLT. If you have multiple catalogues with different element names, you can remove this parameter and it's every occurance in this XSLT. For any other complicated XMLs, there will be a need for a lot more complex editings.--> <xsl:param name="pagedElement" select="'item'" /> <!--With this thing, you don't need to change anything if the pagedElement is just below the root element.--> <xsl:param name="totalRecords" select="count(/*/*[name()=$pagedElement])"/> <xsl:param name="totalPages" select="ceiling($totalRecords div $recordsPerPage)"/> <!--This is the place to turn all or some of the controls off. You can easily do that even outside of the XSLT by setting the desired parameters to "true()".--> <xsl:param name="disablePaginationNavigationControls" /> <xsl:param name="disablePaginationNavigationPrevious" /> <xsl:param name="disablePaginationNavigationControl" /> <xsl:param name="disablePaginationNavigationNext" /> <!--With theese, you can easily manipulate the URLs without many difficulties--> <xsl:param name="localLinkBefore" select="'?n='"/> <xsl:param name="localLinkAfter" /> <!--Include a page wrapper. Optional if the rest of the page is not in this XSLT.--> <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> </head> <body> <xsl:apply-templates /> </body> </html> </xsl:template> <!--This is the first "inside" template that gets executed. It's the place for major interface changes and wrappings.--> <xsl:template match="/*"> <xsl:choose> <!--Change this path to match the place where your content truly is. Change the one at the for-each as well.--> <xsl:when test="*[name()=$pagedElement]"> <dl> <xsl:variable name="startPoint" select="($pageNumber - 1) * $recordsPerPage" /> <xsl:for-each select="*[name()=$pagedElement and position()>=1+ $startPoint and position()<=$startPoint + $recordsPerPage]"> <xsl:call-template name="pagedElement" /> </xsl:for-each> </dl> <xsl:if test="$disablePaginationNavigationControls = false()"> <xsl:call-template name="paginationNavigation"/> </xsl:if> </xsl:when> <!--Alternative action(s) for when there are no appropriate items in the XML.--> <xsl:otherwise> <h1>No items to be paged.</h1> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- Specifyes what to do for each paged element. Be sure to change that. --> <xsl:template name="pagedElement"> <dt><a href="{link}"><xsl:value-of select="title" /></a></dt> <dd><xsl:value-of select="description" /></dd> <dd>Category: <xsl:value-of select="category" /></dd> <dd>Number: <xsl:value-of select="position()" /></dd> </xsl:template> <!--This is the place for changing the paginationNavigation's wrapper and to reorder the controls.--> <xsl:template name="paginationNavigation"> <div class="paginationNavigation"> <xsl:call-template name="previous" /> <xsl:call-template name="paginationNavigationControl" /> <xsl:call-template name="next" /> </div> </xsl:template> <xsl:template name="previous"> <xsl:if test="$disablePaginationNavigationPrevious = false()"> <xsl:if test="$pageNumber > 1"> <a href="{$localLinkBefore}{$pageNumber - 1}{$localLinkAfter}">Previous</a> </xsl:if> </xsl:if> </xsl:template> <xsl:template name="paginationNavigationControl"> <xsl:if test="$disablePaginationNavigationControl = false()"> <ul> <xsl:for-each select="*[name()=$pagedElement and position() <= $totalPages]"> <xsl:variable name="pageNumberControl" select="count(preceding-sibling::*)+1" /> <li> <xsl:choose> <xsl:when test="not($pageNumberControl = $pageNumber)"> <a href="{$localLinkBefore}{$pageNumberControl}{$localLinkAfter}"> <xsl:value-of select="$pageNumberControl" /> </a> </xsl:when> <xsl:otherwise> <span> <xsl:value-of select="$pageNumberControl" /> </span> </xsl:otherwise> </xsl:choose> </li> </xsl:for-each> </ul> </xsl:if> </xsl:template> <xsl:template name="next"> <xsl:if test="$disablePaginationNavigationNext = false()"> <xsl:if test="$pageNumber < $totalPages"> <a href="{$localLinkBefore}{$pageNumber + 1}{$localLinkAfter}">Next</a> </xsl:if> </xsl:if> </xsl:template></xsl:stylesheet> Some of the changes I made are: A major change in the formula for selecting the proper page elements. With yours, some items were missing, and the recordsPerPage varied when set to number different then 5. The totalPages parameter now has a ceiling() for cases when there's a need for an extra non-complete page. I admit you had that anticipated from the start and I was the one to remove it but we are talking about generalization here after all. The different navigation controls can be turned off by setting the appropriate parameters to true(). Scince it's a parameter editing, they can be turned off on different events outside the XSLT, such as the existance of a get variable. Some template and parameter renaming that imply only role now. For example "footer" is now "paginationNavigation" scince the navigation is not always going to be a footer. The parameters "localLinkBefore" and "localLinkAfter" make it extremely easy to edit the URL of all links without actually going all deep into the XSLT. Specifying the pagedElement parameter is enough to estabilish the path if the paged element is located below the root. Removing it can be done without any complications, as long as you remove it's every occurance of course. I've added your lastly requested feature of an alternative action when there are no appropriate items in the XML. I tested it, so I'm sure it will work. Possibly other minor changes to accomodate the big ones And the PHP5 (libxslt) script has only one minor change. I've added the xmlFile and xsltFile variables that hold the file names and nothing more. Here it is: <?php//Prepare the variables.//This is especially usefull if you only want to rename their name in the URL while keeping their functionality$pageNumber = $_GET['n'];$xsltFile = "test.xsl";$xmlFile = "test.xml";//Prepare the XML file$xml = new DomDocument;$xml->load($xmlFile);//Prepare the XSLT file$xsl = new DomDocument;$xsl->load($xsltFile);//Load the XSLT processor$xslt = new Xsltprocessor;$xslt->importStylesheet($xsl);//Prepare parameter changesif (ereg("^[1-9]*[0-9]", $pageNumber)) //Ensure the $pageNumber is really a number{$xslt->setParameter(NULL, 'pageNumber', $pageNumber);}//Execute the transformation$transformation = $xslt->transformToXml($xml);//Show the transformation in the browser. Just before this phase is the right time to check the output if needed.echo $transformation;?> Try to rebuild your catalogue by using this code as a base, and please, combine your <style> elements into one.
  19. None. RSS is XML based format. XSLT reads all XML based languages.
  20. There are many different factors. For starters, price. If they are on the same price where you're getting your domain at, then that's out of the question. The more important part is how they sound. How memorable will the domain name be with a com or net. For example, I wouldn't remember the domain asp.com if the site is suppose to promote the .NET framework. The site asp.net is just perfect for that. On the other hand, people seem to remember some .com sites better then .net ones. So it really is about memory... what is the domain name you plan to register? It might help us to choose wiser.
  21. boen_robot

    XSL:FO

    It depends. If what you're showing is part of the input (XML) then it's simply something like: <xsl:value-of select="transcription/@status" /> And if it's part of the transformation (XSLT) then you should use this instead: <xsl:value-of select="document('')//transcription/@status" /> A document() function with an empty string as an argument means that the XSLT will look into itself for the XPath expression after.
  22. Don't you know? The forum was hacked, and a backup from july 8th was used to restore the forum, so all posts after july 8th are lost.I've made some major modifications scince the last time, including the latest issue you had, but it's at home and currently, I can't connect to my home computer (my mother has probably turned it off). I'll post the code and the PHP5 page as soon as possible. In the meantime, you might want to post the latest ASP one . I hope you implemented the check for whether $pageNumber is a number as I did with the PHP.[edit] What did I said? Yes, I can. Just not now, because it's not on the computer I'm on. [/edit]
  23. What I mean is not to allow entrance of pure HTML in a text area. You could use BBCode as this forum does or create some sort of white list, that is, HTML elements that can be entered, and not allow the user any further modifications. If you choose the BBCodes approach, you must also convert special symbols to entity codes like for example "<" to "<" etc.
  24. I think he refers to <strong>some</strong> text Being rendered as And I must say that if that's the case: that's the worst idea ever. You're practically begging hackers to inject malicios JavaScript there.
×
×
  • Create New...