Jump to content

boen_robot

Members
  • Posts

    8,493
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by boen_robot

  1. Some of the stuff written here is pretty confusing, so my post might probably sound as an offtopic one...Let me explain how this mechanism should work...1. Define an XML language and a schema for it so others could create working XML documents. Apparently, that's done already.2. (Optional) Describe each of your decisions and provide a short tutorial as to how manually to create an XML file that corresponds to the Schema. Essential if you as a creator don't know your clients directly.-It seems you are missing this step, which makes you think you need to learn Schema. Read below, and you'll see that's not necessary-Now there is the usage path. Scince this XML requres a form, then here's the thing. Choose the type of form you'll create. The best choise to go with is XForms. With it, you simply1. Define the XML scructure on the client side.2. The only thing you need to do on the server side is to run a single command that will load the Schema and validate the input with it.3. If the output is valid, write it, if not, return the user to the form with an error message. Generating usefull error messages is another thing I'm not sure how to do, but if you have a deadline, that might not be an issue.If you choose ordinary forms, the situation get's a bit more trickier.1. Create the HTML form with it's fields and all.2. Use some JavaScript to validate the form's simpler parts on the client side to save the server from extra processing. This includes string lenght, mix and max values, but not more complex stuff which only the Schema could define.3. On the server, generate an XML from the post data by enclosing each field's data in the appropriate tags. For example in PHP, this might be something like $element = '<element>' . $_POST['element'] . '</element>'; 4. After the XML is generated as expected, execute the exact same command mentioned for the XForms in order to validate the generated XML against the Schema.5. Again, if it validates, write it and if not, promt the user for alterations.Note that XForms is not supported natively in today's browsers. The only browser which I know has such a native support is XSmiles. Also note that XHTML 1.0 pages that use XForms will not validate anymore.
  2. Such needs are exactly the reason why W3C is going to make the IMG tag open in XHTML 2. What you have as src will be the image and the content inside will be the alt text. Scince it's an element content, this allows more styling options, greather alternatives, etc.There is no currently a way to make this in XHTML 1.0 or any HTML version.
  3. OMG. I'm even more confused now.Anyway, as I mentioned, you could store the result in a variable, or an even more elegant method I realized theese days is to use a string() function as part of the test. At W3School's example, this means something like: ("/bookstore/book[year=string(/bookstore/book[title='Learning XML']/year)]") That would select all books, who's year is the same as the year of the book "Learning XML".In more complicated situations, storing some value as a variable may also be needed, but scince you're not using XSLT, I can't tell you how to do such manipulation.
  4. Translation inside a translation. Wow, that's a neat trick. Never though about it. It's times like this I wish I could bookmark a topic in my account for future reference .
  5. I'm wondering why isn't this the official Opera icon. It's so cool. Maybe it's a legal issue thing .
  6. So you have this XML: <?xml version="1.0" encoding="ISO-8859-1"?><!-- Edited with XML Spy v2006 (http://www.altova.com) --><?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?><catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> <cd> <title>Greatest Hits</title> <artist>Dolly Parton</artist> <country>USA</country> <company>RCA</company> <price>9.90</price> <year>1982</year> </cd> <cd> <title>Still got the blues</title> <artist>Gary Moore</artist> <country>UK</country> <company>Virgin records</company> <price>10.20</price> <year>1990</year> </cd> <cd> <title>Eros</title> <artist>Eros Ramazzotti</artist> <country>EU</country> <company>BMG</company> <price>9.90</price> <year>1997</year> </cd> <cd> <title>One night only</title> <artist>Bee Gees</artist> <country>UK</country> <company>Polydor</company> <price>10.90</price> <year>1998</year> </cd> <cd> <title>Sylvias Mother</title> <artist>Dr.Hook</artist> <country>UK</country> <company>CBS</company> <price>8.10</price> <year>1973</year> </cd> <cd> <title>Maggie May</title> <artist>Rod Stewart</artist> <country>UK</country> <company>Pickwick</company> <price>8.50</price> <year>1990</year> </cd> <cd> <title>Romanza</title> <artist>Andrea Bocelli</artist> <country>EU</country> <company>Polydor</company> <price>10.80</price> <year>1996</year> </cd> <cd> <title>When a man loves a woman</title> <artist>Percy Sledge</artist> <country>USA</country> <company>Atlantic</company> <price>8.70</price> <year>1987</year> </cd> <cd> <title>Black angel</title> <artist>Savage Rose</artist> <country>EU</country> <company>Mega</company> <price>10.90</price> <year>1995</year> </cd> <cd> <title>1999 Grammy Nominees</title> <artist>Many</artist> <country>USA</country> <company>Grammy</company> <price>10.20</price> <year>1999</year> </cd> <cd> <title>For the good times</title> <artist>Kenny Rogers</artist> <country>UK</country> <company>Mucik Master</company> <price>8.70</price> <year>1995</year> </cd> <cd> <title>Big Willie style</title> <artist>Will Smith</artist> <country>USA</country> <company>Columbia</company> <price>9.90</price> <year>1997</year> </cd> <cd> <title>Tupelo Honey</title> <artist>Van Morrison</artist> <country>UK</country> <company>Polydor</company> <price>8.20</price> <year>1971</year> </cd> <cd> <title>Soulsville</title> <artist>Jorn Hoel</artist> <country>Norway</country> <company>WEA</company> <price>7.90</price> <year>1996</year> </cd> <cd> <title>The very best of</title> <artist>Cat Stevens</artist> <country>UK</country> <company>Island</company> <price>8.90</price> <year>1990</year> </cd> <cd> <title>Stop</title> <artist>Sam Brown</artist> <country>UK</country> <company>A and M</company> <price>8.90</price> <year>1988</year> </cd> <cd> <title>Bridge of Spies</title> <artist>T`Pau</artist> <country>UK</country> <company>Siren</company> <price>7.90</price> <year>1987</year> </cd> <cd> <title>Private Dancer</title> <artist>Tina Turner</artist> <country>UK</country> <company>Capitol</company> <price>8.90</price> <year>1983</year> </cd> <cd> <title>Midt om natten</title> <artist>Kim Larsen</artist> <country>EU</country> <company>Medley</company> <price>7.80</price> <year>1983</year> </cd> <cd> <title>Pavarotti Gala Concert</title> <artist>Luciano Pavarotti</artist> <country>UK</country> <company>DECCA</company> <price>9.90</price> <year>1991</year> </cd> <cd> <title>The dock of the bay</title> <artist>Otis Redding</artist> <country>USA</country> <company>Atlantic</company> <price>7.90</price> <year>1987</year> </cd> <cd> <title>Picture book</title> <artist>Simply Red</artist> <country>EU</country> <company>Elektra</company> <price>7.20</price> <year>1985</year> </cd> <cd> <title>Red</title> <artist>The Communards</artist> <country>UK</country> <company>London</company> <price>7.80</price> <year>1987</year> </cd> <cd> <title>Unchain my heart</title> <artist>Joe Cocker</artist> <country>USA</country> <company>EMI</company> <price>8.20</price> <year>1987</year> </cd></catalog> And XSLT file called cdcatalog.xsl with this content: <?xml version="1.0" encoding="ISO-8859-1"?><!-- Edited with XML Spy v2006 (http://www.altova.com) --><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/><xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">Title</th> <th align="left">Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> </table> </body> </html></xsl:template></xsl:stylesheet> Both in the same folder and when you run the XML it doesn't work? Try out the samples above. Directly copyed from W3Schools too. They should work. If you make any edits onto this sample, tell us what have you done.
  7. What do you mean by "repository"?Nvermind...Well, considering that parts would be related, a database like MySQL would certanly serve well. Then again, you were suppose to use XML, as it's readable by those applications, right?So... in your case I would suggest SQL based database if you could, but if you must use XML, I suggest you create one file with links to each part's XML file. Infact, you may use RDF as more application may be able to read the code.
  8. boen_robot

    wow 263

    It's Yesterday, 11:26 PM on my time though.I know it's been a day. I'm talking about the hour...11:26PM.... hm... I was watching TV then. Too bad I've missed it. 310... wow... even if this includes guests, it's still a lot of people. Maybe a hacker was attempting a DOS attack .
  9. The most important question here is if that occurs only with Xalan. Does it?Anyway, I've heared about the <xsl:namespace-alias> element, but you should be able to directly use that namespace too.
  10. Good catch Reg Edit . I was planning to suggest creating a pulling scheme. Something I myself had problems with... I solved them with this: <xsl:template name="menu" match="menu"> <ul> <xsl:for-each select="item"> <li> <xsl:if test="menu"> <xsl:attribute name="class">submenu</xsl:attribute> </xsl:if> <a href="{link}"> <xsl:value-of select="title"/> </a> <xsl:if test="menu"> <xsl:apply-templates select="menu"/> </xsl:if> </li> </xsl:for-each> </ul> </xsl:template> However, this code expects that the currect list and the surpriselist have the same name ("menu" in my case). If you have to handle different element names, the situation might get a bit trickier. Not handling particular elements on particular levels would make it a real challenge too.
  11. Exactly the kind of thing the linear to tabular data code is created.
  12. Why do I have this weird deja vu.... I think I've answered this one. And I think I've answered it before the hack&back.Hopefully, now you'll tell me if what I suggest works, instead of shutting up.The path ../Parameter[Name=@Dependency]/ParameterEnum would mean that the value of @Dependancy and Name on the same Parameter must be equal before ParameterEnum is selected. The way I see it, in your XML they don't have equal values. If I gather correctly, you're trying to pull the value of @Dependency which is not on the same level.Maybe if you store that other value in a variable.... or.... uh... show me the XSLT in which you use that. I would guide myself better that way. Or are you using some other language?
  13. It's not me who calls it data islands. It's Microsoft. Look (again?) at this part of the XML tutorial at W3Schools. And it's not the XML that's called Data Islands. It's the method for getting the XML data into HTML .You can use pure JavaScript and/or PHP to get the XML data into the HTML, but that's not what I'm suggesting. I suggest you create an XSLT that will turn for example <mailURL>john.doe@acme.inc.com</mailURL> into <a href="mailto:john.doe@acme.inc.com">john.doe@acme.inc.com</a> etc.And then execute that XSLT transformation with the JavaScript code suggested above. The only thing JavaScript will do is to call the XSLT file and tell the browser to execute the instructions in it. The presentaion itself it controlled from the XSLT file itself.
  14. Is this a math forum, an offtopic forum or anything similar? I just can't help to ask that...
  15. The only thing about HTML which I read before W3Schools was in a Bulgarian magazine. They briefly described HTML and how it's misused when CSS should be used for presentaion, along with simple examples of both. Scince I already had some knowedge in engligh, I was amazed as to how simple the syntax is. Up to that point I though that HTML contains a lot of weird garbage whereas this magazine showed me that's not always true. I then looked at a forum I was visiting. There, a forum known as PC School was advertised. I looked there and they were all deticated to web design, along with 3D graphics (a thing I was more interested at that point). At this new forum, I saw a thread about different sites for tutorials and guess which one was there. W3Schools of course. That's when my true studyings began.
  16. 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.
  17. What you describe are practically all problems Data Islands carry. They are as attractive as the <font> tag once was... a variety of problems they present and for which no one is using them are: Viewable only in IE5.5+. Infact, I can't believe this sentence: "N.b. the web page does display the data of the XML file correctly in the various web browsers.". Only fills element's contents. It can't fill attribute's contents and unfortunatly, that's just the case with images, links and most of the other usefull stuff. XLink's purpose isn't about turning this text into links. The story is much more deeper. Requres the XML to follow a consistant naming scheme. It can't handle "odd" XMLs. It can't query attributes (as far as I'm aware). A lack of XPath expressions, leaving you almost nothing. And the list could go on, but there's no need for that.The best way to turn XML data into XHTML data has always been with XSLT. XSLT transformations can be executed either by launching the XML file (not what you want to do I guess) or by using this or similar JavaScript to call it inside an HTML page. Other ways include to call it with a server side scripting, but I guess you're trying to avoid that.
  18. I didn't quite catch the deal here, but they again, I might not need to. How about something like: <xsl:template name="details"><details><xsl:apply-templates select="detail"><xsl:sort select="A/@app"/><xsl:sort select="A/@id"/><xsl:sort select="A/@part"/><xsl:sort select="A/@factor"/><xsl:sort select="A/@inc"/></xsl:apply-templates></details></xsl:template><xsl:template match="detail"><!--The stuff you needed to use position() for. You can use it here.--><xsl:call-template name="detail"/></xsl:template>> Note: It might be even better if the template called "detail" is actually in the matched "detail" template.
  19. Sorry. Didn't had Internet for quite a while ...Anyway, how to merge them if they don't have the same structure... it depends: Which one of the two document's root element is going to be the new XML's root element? Or is it going to be a new root element, defined in the XSLT itself? Does any of the merged document need to be transformed into somekind, or should it be copied directly as with the first example? What type of structure is the new XML expected to hold? Any difference with the original? Let's me go into the easiest scenario first: <xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/*"> <xsl:element name="{name()}> <xsl:copy-of select="*"/> <xsl:copy-of select="document('xml2.xml')/*/*"/> </xsl:element> </xsl:template></xsl:stylesheet> This will make a copy of every XML's non-root nodes and place them in a new one, who's name is defined by the name of the root element of the first XML. Change {name()} to some literal string to define the name of a new root element instead. This scenario anticipates that both XML's need to be as they are. Cut the "/*" out of the end of the document() line and you'll have the second XML merged completely with the first, along with it's root element. Cut the "*" out of the template match, and you'll have the first XML copied directly too.The other scenarios I've mentioned are more complicated and methods vary depending on the XML's complexity.
  20. I'm not sure I understand the transformational idea correctly, but that "new DTD" stuff is totally wrong. Validating XML documents is optional.You can use DTD, or Schema (or RelaxNG btw) to define legal building blocks of an XML document but that's completely irrelevant to the transformation part. Validating against your own DTD is a good thing, but only when your XML is not only going to be used by you and/or a single application.The same tokenize function I gave example of can turn substrings into text nodes. This is turns means you should be able to apply a markup around each token. This markup can be an ordered list for example with numbers...). Then with CSS you can style each token, say apply indention, etc.However, as I said, this function is not widely supported (if actually supported anywhere), so there is a need for an alternative method. If I understand correctly, what the quote you gave suggests is to first translate the XML into another XML with markup around each row. An XSLT that will turn <para>FOR AN ACT relating to crimes and offenses; to amend sections 28-101,28-201 and 28-932, Revised Statutes Cumulative Supplement, 2004; tochange provision relating to assault by a confined person; to create theoffense of assault...(etc)</para> into <para><row>FOR AN ACT relating to crimes and offenses; to amend sections 28-101,</row><row>28-201 and 28-932, Revised Statutes Cumulative Supplement, 2004; to</row><row>change provision relating to assault by a confined person; to create the</row><row>offense of assault...(etc)</row></para> for example. Then, with another XSLT applyed on this new XML, turn each <para> into <ol> and <row> into <li>. With special conditions, you may even place a class attribute in the output, allowing you furthen styling with CSS.What's this about printing though? Are you actually planning to print this data? Up to this point I was expecting it would go into a web page.
  21. I said JavaScript... on the client side... you're using ASP... server side=> you can do it.As for why it doesn't work... I don't know. I'm not much into ASP.
  22. Looks simple enough. If it doesn't get more complicated then this, you should be alright with something like this: <xsl:template match="/root"><xsl:apply-temlpates/></xsl:template><xsl:temlpate match="content"><!--Change this to the wrapper you need. Like a <div> maybe?--><content><xsl:apply-temlpates/></xsl:temlpate><xsl:template match="img"><img src="{@src}" img-id="{@src}" /></xsl:template> Please note that this approach might requre you to add every other available element as their own temlpate or unify them somehow. I have a hunch on how this unification may be done, but scince I don't have the complete answer right now, I can grant you this: <xsl:template match="br"><br /></xsl:template>
  23. Am I visiting a wrong site, or does this one have some... um... interesting... content in it.... which by the way as far as I'm familiar violates W3Schools' forum rules:
  24. I would prefer to click a link in your signature for a site (owned by you?) containing a lot of links for a given language.
  25. Depends on what you mean by "another server".JavaScript can't access resources on another server. It's a security feature.Server side scripting languages like ASP (the first examlpe you gave) can. So what's the problem? That first example doesn't work on your IIS server or do you mean how can you achieve the same effect with another server side scripting language?
×
×
  • Create New...