Jump to content

boen_robot

Members
  • Posts

    8,493
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by boen_robot

  1. I think the original saying (at least how it's presented in Marvel's Spider Man) was "With great power..." but I guess technology is power. My point exactly.
  2. Try to add this template: <xsl:template match="/{http://maven.apache.org/POM/4.0.0}project"><xsl:apply-templates/></xsl:template>
  3. Try to use a universal selector in the root. That is, instead of <xsl:template match="/project"> try using <xsl:template match="/*"> If that doesn't work, try this: <xsl:template match="/{http://maven.apache.org/POM/4.0.0}project">
  4. Translated or not, there's no way to get a substring-after() on last match. The function itself returns the string after the first occurance of the second argument, not it's last. Using several substring-after() would do, but you'll have to know the depth of the file in advance. This is actually what the tokenize() function does. It devices the string into nodes that you can then access with an XPath expression, so that you can only get the last one.
  5. You might say computers are something in between. A cursed blessing or blessed curse or something like that.As said, there are many sides to look from. There's a saying "it doesn't matter how big is, it's how you use it". True, the context of the saying is another thing (and it's not computer hardware ), but if you just change "big" to "time consuming" or "overwhelming" you get a whole new way of thinking .I mean, let's face it. There's a big difference between a user and a user. Some use the computer as a typewriter and/or calculator. Others use it to share information. Others (like us) use it to create frameworks for sharing information, etc. etc. etc.While for some is a blessing, it's curse for others. But you know what... I think most of the times, it's curse for those that can't afford to use it and/or own it.If you start the "nature" song, then you should think about the petrol first, and then for the stuff for making the hardware. I'm not sure, but I think the second is FAR more ecological then the first. Good thing that after 20 years or so, the petrol and the madness behind it will end.
  6. Yes. Define the contents of the devision element separately and in the subdevision element, allow only: <xs:element ref="devision" minOccurs="1" maxOccurs="unbounded"/> In other words, you'll be defining an element that calls itself.
  7. What you're doing seems pointless. Try to learn XSLT.
  8. boen_robot

    PHP and XML

    PHP4 has equivalent DOM XML functions but I don't think a Schema validation is among the supported objects. You'll have to upgrade.
  9. boen_robot

    PHP and XML

    Actually the term is "check/validate against", not "compare" for obvious reasons .This article shows a simple function for that in PHP5.So, I think this should work as a simple errorless validator, though I haven't tested it: <?php$dom = new DomDocument();$dom->load("test.xml");if ($dom->schemaValidate('schema.xsd') === FALSE) {echo "Invalid XML document";}else {echo "VALID XML document";}?> Every other action that is XML realated uses other DOM functions. Be sure to check them out.
  10. It should work perfectly fine if that server supports ASP.NET as well as everything that might be needed to run this ASP.NET script. If not- it won't work.
  11. A namespace should be a URL I think. Techinally speaking, it's only a trigger for a special behavior or a lack of it, so it shouldn't be a matter of a valid URL or anything.In order to check if a document is valid against a Schema you need to execute that validation with a (server/client side) script. It's a responsibility of the validator itself to provide the different error messages, but it's up to you if you'll show them or not, alter those messages as they come, do something on success or on failure, etc.How important is it... hm... currently, it's not important at all if your application will be the only one using the data. If other applications will be using the application with their own XMLs though, Schema is the best way to check if your application will handle the other party's documents or not.In the near future, when XSLT 2.0 comes, Schema will also be one way to tell the XSLT processor what data type to expect on each node and react properly on it. For example, if you define the element <date> with a contents of type xs:date, you'll enable the XSLT processor to perform date comparrisons with this element. Even without a schema, XSLT 2.0 could convert an ordinary string to a date by the usage of the xs:date($XPath-expression-to-the-date-element) function.The most important usage of Schema remains validation of input that doesn't come from yours truly.
  12. Maybe because you have dashes in your XML before your opening tags. That's only a browser's way of rendering raw XML. It's not how an XML file's source should look like. Remove all dashes ("-") and try again.
  13. You are just not allowed to call this page from an ordinary HTML page. I mean... you just can't. Forget it. Apparently, that page is made in a way that requres it to be called from .NET in order to be processed.
  14. As you said, you don't have an XSLT 2.0 processor, so the error is to be expected.Honestly said, I can't think of a way to do this in XSLT 1.0. It will requre much string manipulation, and XPath 1.0 capabilities are not that strong.What processor exactly are you using anyway? libxslt? Xalan (god knows the host language)? If you're using libxslt (say on PHP5) you can use the EXSLT tokenize() function in the very same way as desribed above.
  15. This article shows how to do grouping by the use of xsl:key and the associated key() function. I'm still not experienced in them, but I know they are the way to go for groupings.
  16. The first thing I think I need to know is if you use Saxon or any other (which one btw?) XSLT 2.0 processor? If not, the reverse() function won't work, scince it's XPath 2.0 function.If you are using an XSLT 2.0 processor, I think that the reverse() function reverses only the order of existing items in a node set. As in <xsl:sort order="ascending"/>, but within the seqence itself. Because of that, I think this would return an error on strings, though I'm not sure.How exactly does your input look like btw? If you're trying to extract only the filename in a certain URL string and you ARE using an XSLT 2.0 processor, then perhaps something like the tokenize() function might help. <xsl:value-of select="tokenize(File_Filename0,'\/')[position()=last()]"/>
  17. What you're showing me is the source of an ASP.NET page. The source of the file BEFORE being processed by IIS.If you're trying to run this file without IIS, the error is obvious and predictable and what you need is to process this page over IIS.If you DO run it with IIS, then the question is what the source code of the page is AFTER processing. For example, if ad.aspx.cs returned nothing, the output of the file should be: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> </div> </form></body></html> Which should render fine. True, it won't show nothing, as it doesn't have anything visible in it, but you'll at least see "Untitled Page" in the title bar and a blank screen, instead of an error.If the output source code is the same as the ASP.NET source, then for some reason, your IIS server is not processing *.aspx files, resulting in the error.
  18. <xsl:for-each select="/eligVerification2Response/eligVerification2Result/eligVerification/eligRequest/eligSubscriber/eligResponse/eligInformation"><xsl:value-of select="@eligBenefitPlanDescription"/></xsl:for-each> This should be "working" if by "working" you mean show "NW ABC".If it doesn't, fix the error in the XML I mentioned above, and try again. Believe me, this extra ">" is NOT fine.
  19. The XML file is called "input" by the way. For the XSLT at least. "Output" is what you get after the transformation .In the worst case, use absolute paths. With a slash at the beginning:<xsl:for-each select="/eligVerification2Response/eligVerification2Result/eligVerification/eligRequest/eligSubscriber/eligResponse/eligInformation"><xsl:value-of select="@eligBenefitPlanDescription"/></xsl:for-each> good thing you just saw eligBenefitPlanDescription is actually an attribute and as such needs the @ .
  20. I've been recetly playing Need For Speed: Carbon, alongside Guild Wars, so I hadn't touched the script scince we last left it:XMLmanipulator.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><title>Edit form</title><head></head><body><form action="XMLmanipulator.php" method="post"> <select id="action" name="action"> <option value="add">add</option> <option value="remove">remove</option> <option value="edit">edit</option> </select> <input type="submit"/></form></body></html> XMLmanipulator.php <?php//Prepare the variables and constants$xmlFile = "photo.xml"; //Your XML file$action = $_POST["action"]; //What are we going to do with it$DBroot = "images"; //This is the element storing everything else.$DBunit = "img"; //The elements you have in the pseudo DB.//Prepare the XML file.$dom = new DomDocument;$dom->load($xmlFile);$xpath = new DomXPath($dom);//Perform the desired actionswitch($action){ case "add": $parent_path = "/" . $DBroot; $next_path = "/" . $DBroot . "/" . $DBunit . "[position()=1]"; // Find parent node $parent = $xpath->query($parent_path); // new node will be inserted before this node $next = $xpath->query($next_path); // Create the new element $element = $dom->createElement($DBunit); //A pathetic attempt to create an attribute within the new element. //Commented for the sake of what's already working. /*$cat = $dom->createAttribute('cat'); $catText = $dom->createTextNode('TEXT'); $newDBunit = $dom->appendChild($element);*/ // Insert the new element $parent->item(0)->insertBefore($element, $next->item(0)); $content = $dom->saveXML(); break; case "remove": echo "REMOVE Not implemented"; break; case "edit": echo "EDIT Not implemented"; break;}//Save the output and notify if there are any errors.if (file_put_contents($xmlFile,$content)== FALSE){echo "Error writing to file";}else{echo "File written successfully. " . file_put_contents($xmlFile,$content) . " bytes written.";}?> Important: I realized that in this form, when you click REMOVE or EDIT, the file_put_contents() attempts to do the writing, returns an error and a message AND THE FILE'S CONTENT IS GONE. When EDIT and REMOVE are ready, this won't happen. A temporary fix would be to move the function and it's check back to the 'case "add"'.
  21. Have you checked your XML for well formdness? It seems there's an error here: <eligRequest transactionId="WERS"clientSecurityKey="ABCD"loc_info="true">> There must be only one ">". And who knows if you have other errors.Also, is the template the for-each is used in with a match="/"? If not, you'll need an alternative XPath expression to access the value. What exactly depends on the actual match.
  22. Yes. This is what you wanted, right? If you're asking choco, I think he's giving the link for my sake, not for yours .True Image could also close HDDs, but I think it only increases them proportionally like Notron Ghost. Partition Expert/Manager can copy them in a ratio you specify, only move a partition, remove it, format it, resize it, convert it and all that cool stuff you've always asked yourself if it could be done .
  23. Blank? As in "no source code at all"? a file looking like this:?Then where could IE invent the "<%@ Page Language="C#" AutoEventWireup="true" CodeFile="aa.aspx.cs" Inherits="aa" %>" thing? Or does the ASP itself have some sort of error, that forces a blank output.
  24. boen_robot

    More one

    Well, obviously, you need to create the parameter to begin with. For example, if you want to have a $thing to compare against, with a default value of "moo", you can define it like this: <?xml version="1.0"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="xml" indent="yes"/><xsl:param name="thing" select="'moo'"/><xsl:template match="/"><foo> <xsl:for-each select="/thing[name = $thing]"> <moo/> </xsl:for-each></foo></xsl:template></xsl:stylesheet> And the way to pass params varies depending on the language used to execute the transformation. For JavaScript, all I can offer you is the function in this post which is the closest thing you can get to. That JS needs to be executed from within the XSLT. With adjustments, you might be able to use it from somewhere else.
  25. It depends on where you've installed Apache. On Windows, the default path is: C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf If it's not there, make a search for "httpd.conf". I doubht there will be other files named like that.By the way, from this file, you can adjust everything Apache has to offer.
×
×
  • Create New...