Jump to content

Any fast way to do this?


Guest FirefoxRocks

Recommended Posts

Ok I will do that once I finish converting all my recipes to XHTML. Hopefully I get it done before Christmas. :)
Weren't they ALL already converted to XHTML :) ? Huh... interesting. Still, you should try THAT one now before you covert the rest to at least ensure it's working.
Link to comment
Share on other sites

  • Replies 58
  • Created
  • Last Reply
  • 2 months later...
It doesn't work!!!
What is that suppose to mean? Any error messages? If so, what? A sample X(HT)ML file I could look at (in case you got a wrong format)?
Link to comment
Share on other sites

Guest FirefoxRocks
What is that suppose to mean? Any error messages? If so, what? A sample X(HT)ML file I could look at (in case you got a wrong format)?
There's no output at all, just a blank page to look at. I can post the XSLT file when I get the USB drive back from my mom (she's adding more Microsoft Word recipes unfortunately).
Link to comment
Share on other sites

Guest FirefoxRocks

Ok here are both of my files:recipes.xsl

<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="recipes.xsl"?><recipes><recipe>1-2-3-4 cake with Creamy Chocolate Frosting.html</recipe><recipe>Baked Ham.html</recipe><recipe>Gravy.html</recipe><recipe>Basil Tea.html</recipe><recipe>Bean Soup.html</recipe><recipe>Black Chocolate Cake.html</recipe><recipe>Blueberry Buckle Coffee Cake.html</recipe><recipe>Blueberry Fruit Sauce.html</recipe><recipe>Bran Muffins.html</recipe><recipe>Cabbage and Pasta Soup.html</recipe><recipe>Caramel Apple Cake.html</recipe><recipe>Caramel Pudding.html</recipe><recipe>Cherry Tea Bread.html</recipe><recipe>Chervil Cream Dressing.html</recipe><recipe>Chicken Soup with Lemon.html</recipe><recipe>Chocolate Mint Sauce.html</recipe><recipe>Best Lemon Loaf.html</recipe><recipe>Christmas Cake.html</recipe><recipe>Cilantro Sauce.html</recipe><recipe>Cinnamon Apple Chutney.html</recipe><recipe>Coconut Kisses.html</recipe><recipe>Cold Potato Salad.html</recipe><recipe>Cornflake Macaroons.html</recipe><recipe>Cranberry Sauce.html</recipe><recipe>Cream Puffs with Chocolate Mint Cream.html</recipe><recipe>Curry Powder.html</recipe><recipe>Date Nut Muffins.html</recipe><recipe>Deviled Eggs.html</recipe><recipe>Dumplings.html</recipe><recipe>Fruit Cake.html</recipe><recipe>Fruit Cocktail Cake.html</recipe><recipe>Fruit Jumbos.html</recipe><recipe>Fruit Punch.html</recipe><recipe>Fruit Squares.html</recipe><recipe>Fruited Lemon Loaf.html</recipe><recipe>Fudgy Chocolate Cake.html</recipe><recipe>Graham Wafer Cake.html</recipe><recipe>Grandma's Cocoa Cake.html</recipe><recipe>Grandmother Cressman's Applesauce Cake.html</recipe><recipe>Green Rice.html</recipe><recipe>Health Cookies.html</recipe><recipe>Johnny Cake 1.html</recipe><recipe>Johnny Cake 2.html</recipe><recipe>Juicy Meat Loaf.html</recipe><recipe>Kanten Directions.html</recipe><recipe>Lemon Basil Ravioli.html</recipe><recipe>Lemon Cinnamon Pears.html</recipe><recipe>Lemon Squares.html</recipe><recipe>Lemon Tea Bread.html</recipe><recipe>Lime Asparagus.html</recipe><recipe>Loaf O Gold Cake.html</recipe><recipe>Macaroni with Olive Sauce.html</recipe><recipe>Meatball Soup.html</recipe><recipe>Melting Moments.html</recipe><recipe>Minestra.html</recipe><recipe>Mint Punch.html</recipe><recipe>Mint Tea.html</recipe><recipe>Molasses Graham Bread.html</recipe><recipe>Oatmeal Cereal Cookies.html</recipe><recipe>Oatmeal Muffins.html</recipe><recipe>Orange and Oat Chewies.html</recipe><recipe>Pecan Fingers.html</recipe><recipe>Penne with No Cook Basil Sauce.html</recipe><recipe>PIE OR TART SHELLS.html</recipe><recipe>Potato Salad.html</recipe><recipe>Quick Spoon Bread.html</recipe><recipe>Quick Sweet and Sour Chicken.html</recipe><recipe>Raspberry Mint Seltzer.html</recipe><recipe>Rhubarb Cake.html</recipe><recipe>Rice Flaked Balls.html</recipe><recipe>Rolled Oatmeal Cookies.html</recipe><recipe>Shortbreads.html</recipe><recipe>Some Ideas for Basil.html</recipe><recipe>Sour Cream Spice Cake.html</recipe><recipe>Sugar Cookies.html</recipe><recipe>Sweet and Square.html</recipe><recipe>Sweet Potato Salad.html</recipe><recipe>Tagliatelle with Smoked Salmon and Caviar.html</recipe><recipe>Tomato Soup.html</recipe><recipe>Triple Citrus Cheesecake.html</recipe><recipe>Vegetable Salad with Cilantro and Lemon.html</recipe><recipe>Wacky Cake.html</recipe><recipe>Zucchini Basil Soup.html</recipe><recipe>Cinnamon Apple Sweet Potatoes.html</recipe><recipe>Persimmon Lime Freeze Recipe.html</recipe><recipe>Citrus Kiwi Fruit Salad.html</recipe><recipe>Lime-Orange Punch.html</recipe><recipe>Coconut Tarts.html</recipe><recipe>Courgette Salad.html</recipe><recipe>Tuna and Tomato Salad.html</recipe><recipe>Do Ahead Coconut Pound Cake.html</recipe><recipe>Poached Peaches.html</recipe><recipe>Mile High Biscuits.html</recipe><recipe>Raspberry Party Punch.html</recipe><recipe>Reception Punch.html</recipe><recipe>Red Christmas Punch.html</recipe><recipe>Egg Pie.html</recipe><recipe>Sour Milk.html</recipe><recipe>Griddle Cakes.html</recipe><recipe>Pasta and Vegetables.html</recipe><recipe>Whole Wheat Pancakes.html</recipe><recipe>Bonbon Cookies.html</recipe><recipe>Singapore Sling Slush.html</recipe><recipe>Fresh Fruit Punch.html</recipe><recipe>Christmas Cranberry Cocktail.html</recipe><recipe>Cranberry Punch.html</recipe><recipe>Doris' Pie Crust.html</recipe><recipe>Rolled Oatmeal Cookies(2).html</recipe><recipe>Potato Cakes.html</recipe><recipe>Curried Prawn Salad.html</recipe><recipe>Peanut Butter Cookies.html</recipe><recipe>Tuna and Pasta With Red Kidney Beans.html</recipe><recipe>Chocolate Raspberry Squares.html</recipe><recipe>Come and Get Them Cookies.html</recipe><recipe>Blackberry Cobbler.html</recipe><recipe>Basic Herb Vinaigrette.html</recipe><recipe>Shakin' it Up.html</recipe><recipe>Apple Loaf.html</recipe><recipe>Spiced Crabapples.html</recipe><recipe>Dilly of a Dip.html</recipe><recipe>Chanukah Latkes.html</recipe><recipe>Tea Biscuits.html</recipe><recipe>Bowtie Salad with Herbs and Lemon.html</recipe><recipe>Birthday Party Punch.html</recipe><recipe>Kwanzaa Benne Cakes.html</recipe><recipe>Dutch Almond Triangles.html</recipe><recipe>Chococherry Macaroons.html</recipe><recipe>Rocky Road Squares.html</recipe></recipes>

I thought that if I manually generated the XML file, I didn't need to do the PHP thing.

Link to comment
Share on other sites

True. The idea behind the PHP was to generate the XML file based on all of the directories you have. Creating it manually eliminates the need for PHP. If you want to save the result to a file though, you still need to use SOME utility, be it PHP, or simply an editor like Stylus Studio that has this option.However, for this to work, ALL of the listed files need to be at the location specified by the respective recipe element, relative to the XSLT stylesheet, so if you want this to run, you need to place the XSLT file in the directory with all recipes and adjust the location in the XML file to the stylesheet accordingly.Also, the actual contents of each file must be XHTML having at least the following as its contents for example:

<html xmlns="http://www.w3.org/1999/xhtml">	<head>		<title>1-2-3-4 cake with Creamy Chocolate Frosting</title>	</head>	<body>		<p>This is the recepie for 1-2-3-4 cake with Creamy Chocolate Frosting</p>	</body></html>

You can add other things too (DTD, XML prolog, lang attribute(s), etc.), but at least theese must be present if you want to see something.

Link to comment
Share on other sites

Guest FirefoxRocks
True. The idea behind the PHP was to generate the XML file based on all of the directories you have. Creating it manually eliminates the need for PHP. If you want to save the result to a file though, you still need to use SOME utility, be it PHP, or simply an editor like Stylus Studio that has this option.
I just need to view and search all recipes (using the browser search thing) and print all recipes.
However, for this to work, ALL of the listed files need to be at the location specified by the respective recipe element, relative to the XSLT stylesheet, so if you want this to run, you need to place the XSLT file in the directory with all recipes and adjust the location in the XML file to the stylesheet accordingly.
My XSLT file is saved in the same directory as my XHTML files and the XML file.
Also, the actual contents of each file must be XHTML having at least the following as its contents for example:
<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1_strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><title>Dilly of a Dip</title><link rel="stylesheet" href="css.css" type="text/css" /></head><body><h1>Dilly of a Dip (vegetable dip)</h1><h3>Ingredients:</h3><ul><li>250 mL (1 cup) cottage cheese, creamed</li><li>125 mL (½ cup) plain yogurt or plain sour cream</li><li>10 mL (2 tsps) dried dill OR 30 mL (2 tbsps) fresh dill</li><li>5 mL (1 tsp) lemon juice</li><li>30 mL (2 tbsps) finely chopped green onion (optional)</li></ul><h3>Procedure:</h3><ol><li>In a blender, mix cottage cheese, and yogurt/sour cream until smooth.</li><li>Transfer to a bowl and stir in onion, dill, and lemon juice.</li><li>Cover and refrigerate for 2 hours. Serve with assorted vegetables.</li></ol></body></html>

It is an XHTML file, right?

Link to comment
Share on other sites

I'm not sure in which file this belongs, but I put it in Gravy.html just for the sake of the test...You have an error in the location of the DTD. Since this is XML, the XML parser (in IE at least) complains about that. It should be:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd

and you have

http://www.w3.org/tr/xhtml1/dtd/xhtml1_strict.dtd

(i.e. the path is case sencetive)But know putting DTD slows things quite a bit as browsers and other user agents alike will download the DTD before parsing continues. With an internet connection off, this could lead to a fatal error. In other cases it means a few extra HTTP connection (since the DTD is divided into few modules which are also being downloaded).

Link to comment
Share on other sites

Guest FirefoxRocks
I'm not sure in which file this belongs, but I put it in Gravy.html just for the sake of the test...You have an error in the location of the DTD. Since this is XML, the XML parser (in IE at least) complains about that. It should be:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd

and you have

http://www.w3.org/tr/xhtml1/dtd/xhtml1_strict.dtd

(i.e. the path is case sencetive)But know putting DTD slows things quite a bit as browsers and other user agents alike will download the DTD before parsing continues. With an internet connection off, this could lead to a fatal error. In other cases it means a few extra HTTP connection (since the DTD is divided into few modules which are also being downloaded).

I'm using Firefox 3b1 to do this and according to Mozilla, it doesn't download the DTD. Should I do a "Replace in all open documents" to change the DTD to the lowercase path?
Link to comment
Share on other sites

I'm using Firefox 3b1 to do this and according to Mozilla, it doesn't download the DTD. Should I do a "Replace in all open documents" to change the DTD to the lowercase path?
To the upper case path actually.
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd

is the right path.But your best bet is to remove it altogether. It may be that some of your XHTMLs are invalid, which will bother the XML parser. Removing the DTD eliminates this problem. The XHTML is then only required to be a well formed XML document.

Link to comment
Share on other sites

Guest FirefoxRocks
To the upper case path actually.
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd

is the right path.

Oh ok.
But your best bet is to remove it altogether. It may be that some of your XHTMLs are invalid, which will bother the XML parser. Removing the DTD eliminates this problem. The XHTML is then only required to be a well formed XML document.
No they are all well-formed XML documents because they are parsed in the browser as application/xhtml+xml when opened individually and the yellow screen of death doesn't come up.
Link to comment
Share on other sites

Oh ok.No they are all well-formed XML documents because they are parsed in the browser as application/xhtml+xml when opened individually and the yellow screen of death doesn't come up.
Right, but are they all valid XHTML documents? There is a difference between a valid XHTML document and a well formed X(HT)ML document.A well formed XML document is, to put it simply, any XML document that doesn't trigger the yellow screen of death.A valid XHTML document is one that validates against the W3C XHTML validator.If you remove the DTD, your XML is no longer required to be valid. Being well formed would be enough. The above page you have is valid, but is every other page valid too?For the sake of the test, try to create a new XML file that has ONLY this as its contents:
<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="recipes.xsl"?><recipes><recipe>1-2-3-4 cake with Creamy Chocolate Frosting.html</recipe></recipes>

And see if you get anything. If you don't, ensure "1-2-3-4 cake with Creamy Chocolate Frosting.html" is a valid XHTML document and try again. Only once you see something with one of the files you should proceed on applying it to the rest.

Link to comment
Share on other sites

Guest FirefoxRocks
For the sake of the test, try to create a new XML file that has ONLY this as its contents:
<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="recipes.xsl"?><recipes><recipe>1-2-3-4 cake with Creamy Chocolate Frosting.html</recipe></recipes>

And see if you get anything. If you don't, ensure "1-2-3-4 cake with Creamy Chocolate Frosting.html" is a valid XHTML document and try again. Only once you see something with one of the files you should proceed on applying it to the rest.

Ok I tried that, the recipe is a valid XHTML document, and there is still no output!
Link to comment
Share on other sites

Ok I tried that, the recipe is a valid XHTML document, and there is still no output!
This is starting to look ridicilous. I have the following 4 files all in the same folder, and I see an output in all browsers:1-2-3-4 cake with Creamy Chocolate Frosting.htmlGravy.htmlrecipes.xmlrecipes.xslAnd the XML is the full one with all recipies included and the XSL is not changed at all....Have you tried running the XML in another browser? It may show an error there. It would at least give a start as to what might be wrong. I have the feeling encoding might be it. If so, you'll have to save all files as UTF-8 or another encoding that has been applied to all files (UTF-8 is just the easiest to do as its available even in Notepad's Save As menu).If you can, use the file upload feature of this forum to send me a copy of a portion of your recipies, or if you're arfaid someone might "steal" them ( :) ), put a "test only" HTML files and XML file that at least demonstrate the problem.(BTW, FF3a is sooo... alpha... don't rely on it!)
Link to comment
Share on other sites

Guest FirefoxRocks
And the XML is the full one with all recipies included and the XSL is not changed at all....Have you tried running the XML in another browser? It may show an error there. It would at least give a start as to what might be wrong.
Ok I tried it in Opera. Here is the error message:
XSLT processing failed!
Safari, Netscape and Flock load nothing.
I have the feeling encoding might be it. If so, you'll have to save all files as UTF-8 or another encoding that has been applied to all files (UTF-8 is just the easiest to do as its available even in Notepad's Save As menu).
In Notepad++, it says Encode in ANSI (UTF-8 without BOM). Is that supposed to be right?
(BTW, FF3a is sooo... alpha... don't rely on it!)
It's beta :) and I am using it to find bugs in Mozilla, but it has become my regular browser now. Other users still use Netscape 9 and Opera though.
Link to comment
Share on other sites

You've probably tried every other browser that does NOT have a good error reporting. I know this will sound silly but - IE is the best in regards to XML. Try running the stylesheet in it.Opera 9 doesn't support document(). Support for document() in Opera was only added in the second latest 9.5 snapshot. Both before and after, Opera doesn't report ANY errors related to XSLT.ANSI and UTF-8 without BOM are two different encodings, so that can't be right. Try resaving it in Notepad.

Link to comment
Share on other sites

Guest FirefoxRocks
You've probably tried every other browser that does NOT have a good error reporting. I know this will sound silly but - IE is the best in regards to XML. Try running the stylesheet in it.Opera 9 doesn't support document(). Support for document() in Opera was only added in the second latest 9.5 snapshot. Both before and after, Opera doesn't report ANY errors related to XSLT.ANSI and UTF-8 without BOM are two different encodings, so that can't be right. Try resaving it in Notepad.
Well there is a dot beside ANSI, and a checkmark beside a separate option that says UTF-8 without BOM. If I click UTF, the UTF-8 without BOM is disabled. Same with UCF-2 Big Endian (whatever that is).Well I don't have time to try Opera 9.5 right now lol, I'm already trying Firefox 3 beta.Where can I download Internet Explorer for Linux? :)Oh and I tried getting rid of the DTD and still nothing comes up.
Link to comment
Share on other sites

Well there is a dot beside ANSI, and a checkmark beside a separate option that says UTF-8 without BOM. If I click UTF, the UTF-8 without BOM is disabled. Same with UCF-2 Big Endian (whatever that is).Well I don't have time to try Opera 9.5 right now lol, I'm already trying Firefox 3 beta.Where can I download Internet Explorer for Linux? :)Oh and I tried getting rid of the DTD and still nothing comes up.
You've gotta be kiddin' me!Well, try to use Firefox 2 instead of the 3 one. Firefox does allow installation of multiple versions, right? Also, try to save the file as UTF-8... the one where the checkbox is disabled.If all fails, again, create a test case and upload it in the forum.You may also want to try out PHP again. It would on the very least show some output source code. Try it with this code:
<?php$xmlFile = 'recipes.xml';$xsltFile = 'recipes.xsl';$dom = new DOMDocument;$dom->load($xmlFile);$xsl = new DOMDocument;if(!$xsl->load($xsltFile)) {die('Error in XSLT file. The file may not be well formed or it may not exist. The exact error message returned by LibXML is: ' . libxml_get_last_error()->message);}$proc = new XSLTProcessor;$proc->importStylesheet($xsl);if($bytes = $proc->transformToURI($dom,$output)) {die('Error during transformation. The exact error message returned by LibXML is: '  . libxml_get_last_error()->message);}echo 'File "' . $output . '" was created successfully. ' . $bytes . ' bytes were written.';?>

Link to comment
Share on other sites

Guest FirefoxRocks
You've gotta be kiddin' me!Well, try to use Firefox 2 instead of the 3 one. Firefox does allow installation of multiple versions, right? Also, try to save the file as UTF-8... the one where the checkbox is disabled.If all fails, again, create a test case and upload it in the forum.
Ok I rebooted into Windows and tested it in Internet Explorer 7. Had to change a whole bunch of HTML entity names to hexadecimal entity numbers.Here is the output:
The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. --------------------------------------------------------------------------------A name was started with an invalid character. ��<div>
Link to comment
Share on other sites

Ok I rebooted into Windows and tested it in Internet Explorer 7. Had to change a whole bunch of HTML entity names to hexadecimal entity numbers.Here is the output:
Judging by the error message, there is yet another character entity you may need to change.Now that you're on Windows, go to Notepad and save ALL of the involved files as UTF-8. This may be it.
Link to comment
Share on other sites

Guest FirefoxRocks

Ok I did that. It didn't fix the problem at all. What got rid of the error was removing some extra whitespace in my lists.Anyways, now only 1 recipe comes up!!! The first one. No matter what order I put them in, only the first one appears.

Link to comment
Share on other sites

Ok I did that. It didn't fix the problem at all. What got rid of the error was removing some extra whitespace in my lists.Anyways, now only 1 recipe comes up!!! The first one. No matter what order I put them in, only the first one appears.
Well, I suppose the rest of the recipies suffer from the same problem. Remove that extra whitespace in those other lists too. Tedious I know, sorry.
Link to comment
Share on other sites

Guest FirefoxRocks
Well, I suppose the rest of the recipies suffer from the same problem. Remove that extra whitespace in those other lists too. Tedious I know, sorry.
Um no because I checked for whitespace in all the recipes already, it was very time-consuming.
Link to comment
Share on other sites

Um no because I checked for whitespace in all the recipes already, it was very time-consuming.
Whatever it is, its spread across all files. I'm out of guesses. Create an archive that in it contains the XML, XSLT, the displayed HTML file and one of the problematic HTML files.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...