Jump to content

boen_robot

Members
  • Posts

    8,493
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by boen_robot

  1. Here's the post containing the link to the spot where W3C says the style attribute is deprecated. I don't blame you for not believing me though. As you can see in that topic, I didn't believed it myself, until I saw it with my own eyes. Oh, and don't shoot me. I'm just a messanger .
  2. I'm not entirely sure about the centering, but I think it's that inline elements are aligned with text-align: center; and block elements with margin: 0 auto;. I don't know for sure. Most of the times I use them both anyway.As for the style attribute, I'm absolutely sure. It's this forum where I learned that. There was a link to the place in the specification it was said that the style attribute is deprecated, but I can't find it. If I do find it, I'll show you the link.
  3. Hm, no. That would result in an empty node set, because it would mean processing the main document. Or if I must say it with words:For each root element in the document $Nav, which happens to be navigation.xml in the same folder, call the template called "menu" which would do something for each "menu" found in the current position of the main document, and that position happens to be the root of the main document (see the template calling navigation).
  4. A class is a group of elements that shares special properties. It's practically the same thing as the ID you give to a div with the difference it's suppose to be used multiple times, while ID is suppose to be used only once per page (and therefore has higher priority).And div is just an element to define a division (box), you know. It's styled by using classes and IDs.Using multiple classes saves a lot of code. Instead of having <div class="1"> <div class="2"> <div class="3"></div> </div> </div> You simply have <div class="1 2 3"></div> Isn't that A LOT less code?As for CSS references, I use the one in Dreamwaver and W3Schools. I use other sites only for their demos. Such sites include cssplay.co.uk, quirksmode.org, positioniseverything.net, etc.[edit] Asking how to define classes is the noobiest question you could have asked, sorry to tell you that. The W3Schools' CSS tutorial shows how. [/edit]
  5. Hello. I have a main XSLT which includes another one for the menu. The data for the menu is in it's own XML file. That said, I need to use the document() function in order to transform the menu data and still transform the main data. So far, so good. But for some reason the function isn't working as I though it would.The important part of the main XSLT: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:include href="navigation.xsl"/><xsl:template match="/">...<div id="left"><xsl:call-template name="navigation"/></div>...</xsl:template></xsl:stylesheet> Where navigation.xsl is <?xml version="1.0" encoding="windows-1251"?><!-- DWXMLSource="navigation.xml" --><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:variable name="Nav" select="'navigation.xml'"/><xsl:template name="navigation"><xsl:for-each select="document($Nav,/)"><xsl:call-template name="menu" /></xsl:for-each></xsl:template><xsl:template name="menu"><xsl:for-each select="document($Nav,menu)"><ul> <xsl:for-each select="document($Nav,item)"> <li> <a href="{document($Nav,link)}"> <xsl:value-of select="document($Nav,menu/item/title)"/> </a> </li> <xsl:if test="document($Nav,menu)"> <xsl:call-template select="menu"/> </xsl:if> </xsl:for-each></ul></xsl:for-each></xsl:template></xsl:stylesheet> And the problematic XML for which I need the document function. <?xml version="1.0" encoding="windows-1251"?><menu> <item> <title>Home</title> <link>#</link> </item> <item> <title>Products</title> <link>#</link> <menu> <!-- Contains other items with a title, link and possibly other nested menu --> </menu> </item></menu> The reason I'm having a template navigation to call the second template menu is that menu is suppose to be repeated for every nested menu.The problem is that for some reason, every document() function below <xsl:for-each select="document($Nav,menu)"> is treated as a relative path to the root of the document, not the previously selected by this for-each path (in this case- menu). It gets worse. Because of call-template which selects itself and because the root <menu> would always exist in the whole file, the template is being looped infinetly, thus eventually causing IE to crash. At the same time, FF is being wise enough to not actually select anything below <xsl:for-each select="document($Nav,menu)"> My desired output is something like this: <ul> <li> <a href="#>Home</a> </li> <li> <a href="#">Products</title> <ul> <!-- Contains other "li"s with an "a" with attribute "href", and possibly other nested "ul" --> </ul> </li></ul> Any ideas?P.S. I can't believe I'm having theese issues. In moments like this I really hope I'm not the only person here interested in XSLT.
  6. There are A LOT of code tips I could give you, but for the sake of good relationships, I'll begin with the more "urgent" ones...instead of using a bunch of nested divs, you could just use one div and use 4 classes to define 4 backgrounds to each of the four sides of the div's corners. I'm not sure if it works, but if it doesn't, you could always do the same with 4 divs instead.Instead of using a scripted image and anchor, you could just style the anchor and it's :hover state.The only tableless thing you've got is the main content. Are you planning to "tablelesslise" the rest of the page(s)? By the way, you've got some "align" attributes left on some of your "p"s. You should export them to CSS.There's always a choise to what to use and what not. Frames aren't the only server-side-scriptless way, though I admit they are the easiest. I mean, there's always AJAX Includes, XML&XSLT, etc.Nevertheless, it looks good though. It only has code based problems to work around. Maybe only the background color... I don't know... the site looks as if it's "nude". Nothing major. Nudity is good anyway (khm...).
  7. For setting the number's color. Did you tryed styling their containing element instead? I mean, if around the <ol> there's a <div>, give the <div> the color instead. Then give the <ol> the different color to give the list items all the same color.If that doesn't work, then I'll have to break it to you that it won't be possible until all browsers support the content property's counter() function.For whitespace, try setting margin between the <li>s like this: li {margin-bottom: 20px; /* For example */color: #000000; /* Remove the <font>. This is what this could help for */} If you would like the last <li> to be without that margin, you would either have to make a special class for it, where you remove the margin, or wait for browsers to support the CSS3 preudo selector(s) for this.
  8. Wouldn't a simple background-image: url("<xsl:value-of select="bglayer/attribute::src"/>"); do the trick? Parenthesis as far as I know are only used inside attribute values. CSS however is consireder plain text, so <xsl:value-of> is the way to go.Oh, and just a tip. Why don't you use the "@" instead of "attribute::"?
  9. I haven't read a single book on XML or a related technology, but I use O'REILLY's reference in Dreamwaver 8. Because of that, I think he has great books and I definetly Reccomend them to you.XML in a nutshell- XML itself only. But technically speaking, it doesn't contain a single thing you can't learn from the tutorial on the site. Infact I may say they make it more complex then it actually is.As for XSLT and other, it's harder, simply because there are many books covering special areas. But the two books from which I have seen some material are theese:XSLT Cookbook- Contains solutions for a variety of XSLT problems you may encounter.XSLT Pocket Reference- I'm not sure if that's what I use in Dreamwaver, but it sure looks "handy".We are talikng books for learing though, so I think theese might be better:XSLT- Such a plain title. I have no idea what could it contain, but it's said that it's suppose to have tutorials.Learning XSLT- If you're going to buy something online, I think that's THE book you need.Oh, there are so many... just see all O'REILLY's XML books
  10. Funny you mention it. I mean, who could lock this topic ?[edit] You're kidding, right? [/edit]
  11. As far as I can see in the XML, you're using XSLT to transform it. So why is the need for Data Islands anyway? Stick with the XSLT. You can use JavaScript to execute the XSLT within the HTML, so it would look the same.As for why the Data Islands don't work, it's probably inconsistent naming scheme. In order for Data Islands to work, all of your desired info must be structured accordingly, not in some weird text-like way you have done. The way this XML looks, it would never work with Data Islands. It could be however usefull with XSLT though. I suggest you forget about Data Islands anyway. Dealing with inconsistent naming schemes is only the first reason for why they are bad.
  12. Well, the first errors I notice are1. The XSLT namespace. It's actually http://www.w3.org/1999/XSL/Transform And nothing else. The namespace you're trying to use causes unstandart behaviour.2. The templates from, to, subject and content could as well exist and apply without the "//". The apply-templates element inside the "/" tepmlate is going to call them anyway.3. Speaking of the template "/", wouldn't it be better if it actually contains the wrapper and calls the mailbox, like this: <xsl:template match="/"><html><head><title>Emails</title></head><body><xsl:apply-templates/></body></html></xsl:template><xsl:template match="mailbox"><H1>Email Listing</H1><xsl:for-each select="email"><table><xsl:apply-templates/></table></xsl:for-each></xsl:template> Try fixing theese, and I'll see later on if something is wrong.
  13. Well, for starters, your XML is not valid. See all the "-" in front of the <CD> elements? They shouldn't be there. When you see the file, click "View Source" the same way you do for HTML pages and you'll see the actual XML code.Another thing is that Data Islands (the method you're using) works only with IE. If you're using ANY OTHER browser, it won't work.Why do you need the JavaScript for, anyway?
  14. I think I should add a small correction to some of the posts above. To center an element you would use margin: 0 auto; while text-align: center; is used for whatever the content of an element (or at least the text).Also, it is said that the style attribute is deprecated too, so you shold declare your per-page styles in a <style> element the way snowboard01 showed in his second example.
  15. There is a bit more something to that you might need to know for the future. XHTMLs specification doesn't allow backgrounds on the <body> but does allow on the <html> element, or at least, that's what Firefox does when it opens *.xhtml files (and it's not suppose to be a bug either, I checked). So for the sake of browsers supporting the application/xhtml+xml MIME type, it is of best practice to use html {background:url("http://photo-url.jpg");} instead
  16. Consireding the fact that IE6 and below are our only target, I would suggest a conditional comment instead. <html><head><style type="text/css" media="screen">@import url("style.css");</style><!--[if lte IE 6]><style type="text/css">@import url("IE6style.css");</style><![endif]--></head><body><div id="wrapper"><!-- All other content --></div></body></html> Where style.css contains the styling with the background on the html element and the glow is used on the wrapper.IE6style.css on other hand would have #wrapper {background: none}; in order to hide the glow and it would still show the gradient image.
  17. What I suggest is actually to always have a gradient background with an untransparent image, but also put a glow for browsers that support alpha transparent PNGs. Consireding the fact that IE7 now supports Alpha transparency, such methods would get very common really soon.I mean, I recently saw for example a shadow effect over an image with alpha transparent PNG and at the same time, the image is accessable for IE6 only without the shadow, but still looking good.I'm talking about the same thing here, with the only difference that our target is the background. Why don't offer better browser better experience, while still allowing non sufficient browsers the decent experience (which you are planning to use otherwise anyway).
  18. Well, you could always use alpha transparent PNG for the glow, but then again, you'll have to hide from IE6 and lower using let's say a conditional comment and/or use some kind of alternative method for IE6.
  19. boen_robot

    CSS in XSL

    Indeed, what I see in your sample is completely traditional approach. Congratulations .Well, if you want to automate the class creating, thus class styling, you may do something like this: <html><style>p.orderdate{color: blue;font-size: 20}p.customer{color: green;font-size: 25}</style><body><xsl:for-each select="*"><p><xsl:choose> <xsl:when test="local-name(current())='order_date'"> <xsl:attribute name="class">orderdate</xsl:attribute> <xsl:value-of select="order_date" /> <xsl:when test="local-name(current())='customer'"> <xsl:attribute name="class">customer</xsl:attribute> <xsl:value-of select="customer" /> <xsl:otherwise> <xsl:value-of select="."/> <xsl:otherwise><xsl:choose></p></xsl:for-each><body><html>
  20. You must pay for the certificate, but you can still learn from W3Schools for free by just reading. In the web development world, the portfolio (previously done work) is more important then a piece of paper prooving your knowledge.
  21. boen_robot

    CSS in XSL

    I'm having this "theory" which treats XSLT as a dynamic language... you seem to be getting the scripting part of that theory, so here is a pointer on it's structural part.How about a style tag in the "main" XSLT in which there is only <xsl:call-template select="style"/> and the template style is actually included in another XSLT file which contains the desired "dynamical CSS settings". What would you say of this approach?Or if I get you wrong, you are actually thinking of the same thing, but you're wondering how to construct it? The approach I would go for is something like: div.something {font-size: <xsl:choose><xsl:when test="local-name(node-set)='whatever'">110</xsl:when><xsl:otherwise>90</xsl:otherwise></xsl:choose>%; Expanding each word with more conditionals (for example, put conditionals for the class), you can practically create a stylesheet with let's say 100 lines, which would otherwise take at least 200. Just remeber: you're outputting plain text. There is no tag nesting to worry about.
  22. I was talking about this:http://w3schools.invisionzone.com/index.php?showtopic=4216but perhaps I didn't understood you correctly.
  23. I told you earlier in a topic you made that this can only be done by a server configuration. THAT's the thing that manipulate what different URIs mean. You'll have to explicitly set that files with no extension are HTML files so it can show them in the browser and/or set the index file name to the name mathing your file in that folder. It doesn't matter if you use PHP or ASP.
  24. Hmm. That's a funny one. Never though it's possible. Well, accordingly to the code you gave earlyer, maybe something like this would do: <?xml version="1.0"?><?xml-stylesheet type="text/xml" href="#stylesheet"?><!DOCTYPE data [<!ATTLIST xsl:stylesheet id ID #REQUIRED>]><data><xsl:stylesheet id="stylesheet" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <!-- any xsl:import elements if you later on get any --> <xsl:template match="xsl:stylesheet" /><xsl:template match="/"><fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"><fo:layout-master-set><fo:simple-page-master master-name="simple"page-height="29.7cm"page-width="21cm"margin-top="0.2cm"margin-bottom="2cm"margin-left="2.5cm"margin-right="2.5cm"><fo:region-body margin-top="2cm"/><fo:region-before extent="3cm"/><fo:region-after extent="1.5cm"/></fo:simple-page-master></fo:layout-master-set><fo:page-sequence master-reference="simple"><fo:flow flow-name="xsl-region-body"><xsl:apply-templates select="data"/></fo:flow></fo:page-sequence></fo:root></xsl:template><xsl:template match="data"><fo:block><xsl:apply-templates select="param1"/><xsl:apply-templates select="param2"/></fo:block> </xsl:template><xsl:template match="param1"><fo:block font-size="12pt"font-family="sans-serif"space-after.optimum="30pt"text-align="justify"><xsl:value-of select="."/></fo:block></xsl:template><xsl:template match="param2"><fo:block font-size="12pt"space-before.optimum="110pt"text-align="justify"><xsl:value-of select="."/></fo:block></xsl:template></xsl:stylesheet><param1>hello</param1><param2>world</param2></data>
  25. There is no "plain XML & XSLT" way to do that. You could use something like some complex JavaScript with(out) E4X, but it's very complicated and the only thing it does is to embed the files in one XHTML file. It doesn't change the way the XSLT treats the XML.If you need a data model (what's (not) allowed where) you should use DTD or better yet- Schema, to define those legal building blocks. If you use schema, you might be able to make the XSLT look into it as a data model reference.
×
×
  • Create New...